# An In-Depth Comparative Study of Quantum-Classical Encoding Methods for Network Intrusion Detection

Adam Kadi, Aymene Selamnia, Zakaria Abou El Houda, Hajar Moudoud, Bouziane Brik, Lyes Khoukhi

► To cite this version:

Adam Kadi, Aymene Selamnia, Zakaria Abou El Houda, Hajar Moudoud, Bouziane Brik, et al. An In-Depth Comparative Study of Quantum-Classical Encoding Methods for Network Intrusion Detection. IEEE Open Journal of the Communications Society, 2025, 6, pp.1129-1148. 10.1109/OJCOMS.2025.3537957. [hal-05410731](https://hal.science/hal-05410731v1)

HAL Id: hal-05410731

https://hal.science/hal-05410731v1

Submitted on 23 Jan 2026

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons CC BY 4.0 - Attribution - International License
Received 30 November 2024; revised 14 January 2025; accepted 28 January 2025. Date of publication 31 January 2025; date of current version 18 February 2025.

Digital Object Identifier 10.1109/OJCOMS.2025.3537957

# An In-Depth Comparative Study of Quantum-Classical Encoding Methods for Network Intrusion Detection

ADAM KADI<fnref n="1" />,<fnref n="2" />, AYMENE SELAMNIA<fnref n="1" />,<fnref n="2" />, ZAKARIA ABOU EL HOUDA<fnref n="1" /> (Member, IEEE), HAJAR MOUDOUD<fnref n="3" /> (Member, IEEE), BOUZIANE BRIK<fnref n="4" /> (Senior Member, IEEE), AND LYES KHOUKHI<fnref n="4" /> (Senior Member, IEEE)

CORRESPONDING AUTHOR: Z. ABOU EL HOUDA (e-mail: zakaria.abouelhouda@inrs.ca)

This work was supported in part by Mitacs under Grant IT40176.

*(Adam Kadi and Aymene Selamnia contributed equally to this work.)*

**ABSTRACT** In today's rapidly evolving cyber landscape, the growing sophistication of attacks, including the rise of zero-day exploits, poses critical challenges for network intrusion detection. Traditional Intrusion Detection Systems (IDSs) often struggle with the complexity and high dimensionality of modern cyber threats. Quantum Machine Learning (QML) seamlessly integrates the computational power of quantum computing with the adaptability of machine learning, offering an innovative approach to solving intricate and high-dimensional challenges. A key factor in QML's performance is the method used to encode classical data into quantum states, as it defines how data is represented and processed in quantum circuits. QML offers promising advances for IDS, particularly through hybrid quantum-classical models. This study presents an in-depth comparative analysis of quantum-classical data encoding techniques for QML-based IDS. To the best of our knowledge, this is the first study to comprehensively evaluate the performance impact of different quantum encoding methods and provide a thorough evaluation of their impacts on the overall model performances. To achieve this, we first present a comprehensive evaluation of quantum and classical data encoding techniques, focusing on four key encoding techniques namely, Amplitude Embedding, Angle Embedding, Instantaneous Quantum Polynomial (IQP) Encoding, and Quantum Approximate Optimization Algorithm (QAOA) Embedding. Then, we develop a hybrid quantum-classical QML model to analyze how each encoding affects classification performance for malicious traffic. Finally, we conduct extensive experiments using two well-known, real-world network attack datasets to assess the accuracy and efficiency of each encoding approach. Our obtained results show notable differences in classification accuracy, underscoring the importance of encoding choice in optimizing QML-based IDS. This study aims to advance the application of quantum methodologies in network security by identifying effective encoding strategies for intrusion detection.

**INDEX TERMS** Quantum machine learning, quantum-classical encoding, intrusion detection system.

## I. INTRODUCTION

WITH the rapid advancements in technology and the proliferation of connected devices, cybersecurity threats like Distributed Denial of Service (DDoS) attacks and network intrusions are on the rise [1], [2]. The increasing

adoption of the Internet of Things (IoT) further amplifies these challenges, making the detection of such attacks more critical than ever. According to Cloudflare data, there has been a significant increase in DDoS attacks involving IoT devices in recent years. The Internet of Things (IoT) is

<footnote n="1">¹INRS-EMT, UMR INRS-UQO, University of Quebec, Gatineau, QC J8Y 3G5, Canada</footnote>

<footnote n="2">²GREYC CNRS, ENSICAEN, Normandy University, 14000 Caen, France</footnote>

<footnote n="3">³Département d'informatique et d'ingénierie, Université du Québec en Outaouais, Gatineau, QC J8X 3X7, Canada</footnote>

<footnote n="4">⁴Computer Science Department, College of Computing and Informatics, University of Sharjah, Sharjah, UAE</footnote>
experiencing exponential growth, with millions of connected
devices around the world. To meet the challenges of intru-
sion detection systems in connected environments, research
work approach explored different approaches, such as Deep
Q-Network (DQN), in environments like the Industrial
Internet of Things (IIoT) and the Social Internet of Things
(SIoT) [3], [4], [5]. However, this expansion is accompanied
by an alarming increase in cyberattacks. Indeed, statistics
show that DDoS attacks targeting IoT devices have risen
by 50 in one year. This increase is particularly concerning,
as it highlights the vulnerability of many poorly secured
devices. Businesses are increasingly targeted by sophisticated
attacks, with Cloudflare reporting that it mitigated 4.5 million
DDoS attacks in the first quarter of 2024. Among these
attacks, HTTP attacks saw an impressive increase of 93%
compared to the previous year. Additionally, network layer
attacks also rose by 28%, underscoring the need to enhance
the security of IoT devices. Volumetric attacks have become
commonplace, with peaks reaching up to 2 terabits per
second. These figures reveal not only the scale of the threats
but also the growing sophistication of the techniques used
by cybercriminals. As a result, businesses must strengthen
their security measures to protect their infrastructures and
data.<fnref n="1" /> Various studies have examined DDoS detection
methods [6], [7], [8], which can be broadly categorized
into traditional, signature-based, or anomaly-based detec-
tion approaches [9], [10], [11]. Traditional methods are
often inadequate as cyber threats grow more sophisticated
and exploit vulnerabilities in large-scale, heterogeneous
networks. This has led to the exploration of QML, which
integrates quantum computing with classical algorithms to
enhance machine learning's ability to tackle complex prob-
lems. Existing works explore the fundamental differences
between quantum networks and traditional Internet archi-
tectures [12], emphasizing the technological advancements
and challenges to be addressed for the future of quantum
communications. Quantum Machine Learning has been
studied in various fields such as physics [13], [26], chemistry,
and Natural Language Processing, with research covering
different learning paradigms including Supervised Learning,
Unsupervised Learning, and Reinforcement Learning [14].
All machine learning techniques rely on four fundamen-
tal elements: data, models, performance measures, and
minimization algorithms. In classical machine learning,
data serves as the raw material for training models,
whether structured or unstructured and is used to extract
meaningful relationships for tasks like prediction or classifi-
cation [15], [16], [17], [18]. In QML, however, data can be
encoded into quantum states, enabling the use of quantum
phenomena such as superposition and entanglement. This
allows for more efficient processing, particularly when
dealing with complex and large-scale datasets. Models in
classical machine learning are mathematical constructs that

learn from data to identify underlying patterns. QML intro-
duces innovative models that leverage quantum mechanics to
enhance data processing capabilities. Among these models
are Quantum Neural Networks, which exploit properties such
as superposition and entanglement to process information
more efficiently [19]. Additionally, quantum kernels allow
for the definition of new similarity measures between data,
paving the way for more powerful learning models. These
advancements provide promising opportunities for solving
complex problems and improving prediction accuracy across
various domains. Performance measures in classical machine
learning typically involve metrics like accuracy, F1-score, or
precision to assess a model's ability to generalize to new
data. In QML, the performance metrics remain similar but
are enhanced by considering quantum-specific factors like
state collapse and decoherence, which offer richer and more
complex evaluations [20].

Finally, minimization algorithms in classical machine
learning, such as gradient descent, are used to adjust
model parameters by minimizing a cost function and
seeking global minima. In QML, quantum algorithms
like Quantum Gradient Descent [21] or the Quantum
Approximate Optimization Algorithm (QAOA) [22] provide
faster optimization. They take advantage of superposition to
explore multiple configurations at once, which can signif-
icantly speed up the convergence process toward optimal
solutions. Together, these elements are transformed by quan-
tum computing, providing new capabilities and opportunities
in the realm of machine learning. The study of classical-
to-quantum encoding is important for realizing the full
potential of quantum computing technologies, particularly in
disciplines such as QML. Qubits, which can represent many
states at once owing to superposition, provide unparalleled
opportunities for processing complicated data on a scale
and speed that classical systems cannot match. However,
this encoding procedure, which turns conventional data
into a format suitable for quantum circuits, has significant
technological and theoretical challenges [23].

Encoding classical data into quantum systems presents
several challenges that must be addressed to ensure the
effective application of quantum algorithms [24]. One sig-
nificant issue is the loss of information that can occur when
complex classical data is simplified to fit within the typically
smaller Hilbert Space of qubits. This process may strip
away critical details, thereby reducing the effectiveness of
quantum computations. Determining how much information
can be efficiently stored and processed by qubits remains
a key challenge. Another obstacle is the prevalence of
quantum errors in current quantum systems, which are
highly susceptible to noise and decoherence. These errors
can compromise the quality of the encoded data and alter
the results of quantum algorithms [25]. Maintaining the
fidelity of encoding is essential to ensure the integrity of
the data throughout the quantum computing process. Any
disturbance during encoding or computation risks causing
irreversible information loss. Additionally, there is a cost

<footnote n="1">¹https://blog.cloudflare.com/ddos-threat-report-for-2024-q1/</footnote>
in qubit resources to consider. Modern quantum computers are limited in the number of available qubits, and encoding more complex data often requires an increase in qubit count.<fnref n="2" /> Efficiently optimizing qubit usage is vital to avoid an exponential rise in resource demands, which could render certain algorithms infeasible. Network Intrusion Detection Systems (NIDS) are essential tools for ensuring network security. As cyberattacks become more sophisticated, traditional detection methods such as signature-based and anomaly-based approaches face challenges in scalability, handling complex traffic patterns, and adapting to new attack vectors. These limitations highlight the need for more advanced methods capable of addressing these challenges. QML offers a promising solution to these complexities. By leveraging quantum computing principles, such as superposition, entanglement, and quantum parallelism, QML can process high-dimensional data and capture intricate patterns. In classical Machine Learning (ML), data is processed using bits, which represent information in binary form (0 or 1). This approach works well for many tasks but struggles with problems involving large volumes of high-dimensional data. Quantum systems, on the other hand, use qubits, which can exist in multiple states simultaneously thanks to superposition. This allows quantum computers to explore many possible solutions in parallel, significantly enhancing computational efficiency. Furthermore, quantum systems can leverage entanglement, where qubits become correlated, such that the state of one qubit can depend on the state of another, even when they are physically separated. This unique property allows quantum systems to model and analyze complex relationships in data in ways that classical systems cannot. In the context of network traffic analysis, these quantum advantages enable the development of more powerful models for intrusion detection. While quantum algorithms excel at processing high-dimensional, computationally intensive problems, classical systems remain effective for many practical tasks, such as model training and evaluation. This creates an opportunity for a hybrid quantum-classical approach, where quantum circuits are used for data encoding and feature extraction, and classical algorithms handle the training and decision-making process. By combining the strengths of both paradigms, we aim to achieve better performance in intrusion detection tasks, particularly in terms of accuracy, adaptability, and computational efficiency.

Our work focuses on leveraging quantum computing principles such as superposition, entanglement, and quantum parallelism to explore and compare quantum-classical encoding techniques within the context of NIDS. Our aim is to evaluate how different encoding methods impact the performance of machine learning models in detecting malicious network traffic. We explore various quantum data encoding techniques to transform classical network traffic data into quantum states. These methods exploit

the unique properties of qubits, allowing for efficient processing of high-dimensional data. The framework employs a hybrid quantum-classical architecture, where quantum circuits handle data encoding, while classical algorithms are used for tasks such as training and decision-making. This combination enables us to evaluate the interplay between quantum and classical paradigms. To validate our approach, we conduct experiments using real-world network attack datasets, comparing the performance of different encoding methods. The results highlight the strengths and limitations of each technique, demonstrating how quantum data encoding can influence classification accuracy and computational efficiency. This framework provides valuable insights into the integration of quantum computing in NIDS research, contributing to the advancement of cybersecurity applications.

The main contributions of this work are as follows:

* We design a novel approach that combines dimensionality reduction techniques with the encoding of classical network data into quantum states. This method ensures efficient preprocessing of high-dimensional network traffic data before quantum processing.

* We conduct an in-depth comparative analysis of various classical-to-quantum data encoding methods, analyzing their impact on the performance of network intrusion detection tasks. This includes an assessment of their efficiency, scalability, and detection accuracy.

* We conduct extensive experiments using two well-known, real-world network attack datasets to assess the accuracy and efficiency of each encoding approach. Our obtained results show notable differences in classification accuracy, underscoring the importance of encoding choice in optimizing QML-based IDS. This modular approach highlights the practical and theoretical contributions of quantum techniques to the domain of network intrusion detection, paving the way for future advancements in leveraging quantum machine learning for cybersecurity.

* We discuss the challenges encountered in implementing quantum machine learning for network intrusion detection, such as hardware limitations and encoding complexities, alongside recommendations for future research to address these limitations.

The remainder of this paper is structured as follows. In Section II, we review the most relevant quantum and classical network intrusion detection methods, emphasizing quantum machine learning techniques and their impact on security. Section III outlines the system model, detailing the quantum-classical encoding methods used, such as Angle Embedding, Amplitude Embedding, IQP, and QAOA Embedding. Section IV describes the implementation, focusing on the hybrid (classical/quantum) structure of our detection models, as well as the experimental setup and evaluation metrics. Section V presents the comparative results of the encoding methods, highlighting their performance and

<footnote n="2">²https://quantumzeitgeist.com/how-much-do-quantum-computers-cost/</footnote>
potential quantum advantage. Finally, Section V concludes the paper with a summary of key findings and suggestions for future research.

## II. BACKGROUND AND RELATED WORK

In this section, we explain the fundamental principles of quantum computing and highlight how these principles can be applied to the development of machine learning models. Particular emphasis will be placed on work carried out in the context of intrusion detection.

### A. QUANTUM COMPUTING PRINCIPLES AND THEIR APPLICATION TO INTRUSION DETECTION

The principles of quantum mechanics that underpin quantum computing open new possibilities for solving problems, including those related to intrusion detection systems (IDS) in cybersecurity. By leveraging quantum algorithms, it may be possible to enhance the detection capabilities of IDS, particularly in the case of sophisticated attacks such as DDoS (Distributed Denial of Service) attacks. Below, we discuss the core concepts of quantum computing, such as superposition, quantum entanglement, and quantum gates, and how these can be applied to improve intrusion detection.

#### 1) SUPERPOSITION AND MATHEMATICAL REPRESENTATION OF QUBITS

In quantum computing, a qubit is the fundamental unit of information. Unlike classical bits, which can only be in one state at a time (either 0 or 1), a qubit can exist in a state of superposition, meaning it can be in both states simultaneously. This ability exponentially increases the computational power of quantum computers. The state of a qubit is mathematically represented as:

$$|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$$

where $|0\rangle$ and $|1\rangle$ represent the two possible states of the qubit, and $\alpha$ and $\beta$ are complex numbers known as probability amplitudes, with the constraint that $|\alpha|^2 + |\beta|^2 = 1$.

Superposition allows quantum systems to perform multiple calculations simultaneously. In the context of intrusion detection, this could enable the parallel processing of vast amounts of network traffic data, significantly speeding up the analysis and identification of potential threats, even in high-volume scenarios like DDoS attacks.

#### 2) QUANTUM ENTANGLEMENT

Entanglement is another core phenomenon in quantum computing. When qubits become entangled, their states become interdependent, meaning the state of one qubit will directly affect the state of another, even if they are far apart. This is described by a mathematical formulation for a two-qubit entangled state, such as the Bell state:

$$|\psi\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$$

Entanglement can be used to enhance the efficiency of quantum algorithms, allowing them to process data more effectively than classical counterparts. In an IDS, entanglement might be used to correlate information from multiple data sources, improving the accuracy of attack detection by analyzing interdependencies across network traffic and system behaviors in a unified quantum framework.

#### 3) QUANTUM GATES AND CIRCUITS

Quantum gates manipulate qubits in quantum circuits. These gates are unitary operations, meaning they preserve the probability distribution of quantum states. Quantum gates perform operations such as rotation, superposition, and entanglement on qubits. Some basic quantum gates include:

* **Hadamard Gate (H):** Creates a superposition of basis states.

* **CNOT Gate:** Entangles two qubits by flipping the second qubit based on the state of the first.

* **Pauli Gates (X, Y, Z):** Rotate qubits around the x, y, or z axes, respectively.

Quantum circuits consist of sequences of quantum gates that manipulate qubits. This ability to perform complex transformations on qubits allows quantum circuits to process and analyze data in fundamentally new ways. In intrusion detection, quantum circuits could be designed to process traffic patterns, identify anomalies, and detect potential intrusions with greater speed and precision than classical methods.

### B. RELATED WORK

Data encoding is a crucial step in enabling classical data to be processed by quantum algorithms, forming the bridge between classical and quantum domains. Effective encoding strategies have been shown to significantly enhance model performance, such as improving classification accuracy and F1 scores by better representing features within quantum states [28]. However, the implementation of these strategies faces challenges related to resource optimization, scalability, and information preservation. For instance, encoding methods must balance the computational complexity and the limited resources of current quantum hardware [35]. As data dimensions increase, encoding complexity can grow disproportionately, potentially negating the theoretical advantages of quantum algorithms [33]. Furthermore, ensuring that essential data characteristics are preserved during the transformation process is critical for maintaining model accuracy and reliability [32].

Existing studies often focus on isolated encoding techniques without providing a comprehensive comparison of their advantages and limitations across diverse datasets and application contexts [36]. This fragmented approach leaves unanswered questions regarding the trade-offs between computational cost, scalability, and data fidelity. Moreover, current strategies often fail to guarantee full information preservation, resulting in potential data fidelity loss during encoding [30], [33].
<figure><img src="image_2.png" /><figcaption>FIGURE 1. Overall architecture of the hybrid quantum-classical model for network intrusion detection: data encoding, nonlinear transformation via quantum circuit, and classical prediction through a dense neural network.</figcaption></figure>

The lack of comprehensive comparative studies between encoding techniques represents a significant research gap. While certain encoding strategies have been optimized for specific applications, key trade-offs, such as computational cost and scalability, remain underexplored [30], [33]. These limitations make it challenging to select an appropriate encoding method for specific quantum machine learning applications. Furthermore, the limited resources and noise-prone nature of current quantum hardware exacerbate these challenges [35]. This study aims to address these gaps by systematically evaluating multiple encoding approaches in the context of network intrusion detection. Alomari and Kumar [34] proposed the DEQSVC strategy, which applies a quantum feature map to the DDoS Evaluation Dataset (CIC-DDoS2019) to enhance the accuracy of DDoS attack detection. Performance evaluations conducted through simulations on the Qiskit platform and an IBM quantum computer demonstrated that DEQSVC outperformed several benchmark algorithms commonly used in intrusion detection systems, achieving an impressive detection accuracy of 99.49%. However, the study presents limitations: it utilizes only a single data encoding method, which limits the exploration of alternative encoding strategies and their potential impact on model performance. Payares and Martinez-Santos [37] presented three quantum models for DDoS threat detection, leveraging angle encoding on a dataset specifically tailored for this application. Their study compared the performance of quantum support vector machines (QSVMs), hybrid quantum-classical neural networks, and a dual-circuit ensemble model. The results showcased impressive accuracy, with the lowest being 96%. However, the study has notable limitations: it focuses on a single threat type, necessitating broader validation across various cybersecurity challenges to evaluate the versatility of the proposed quantum models, and it employs only a single data encoding method, limiting the exploration of alternative encoding strategies and their potential impact on the models' effectiveness. By analyzing their theoretical foundations and practical implications, this work highlights the interplay between encoding methods and model performance [28], [32]. The research emphasizes the need to treat data encoding as an optimizable aspect of

QML models and explores solutions to mitigate hardware constraints, such as hybrid quantum-classical models and variational circuits [36]. These contributions aim to enhance the applicability of QML in real-world scenarios by optimizing encoding strategies to suit specific use cases.

### III. SYSTEM MODEL

In this section, we describe the architecture of the system model, illustrated in Figure 1. Designed for comparing encoding techniques and analyzing their impact on the classification task. The framework comprises three key modules: the preprocessor module, trainer module, and assessor module.

The Pre-processor Module handles data cleaning and dimensionality reduction to ensure compatibility with quantum encoding schemes. Dimensionality reduction is a critical step due to quantum hardware constraints. The Trainer Module embeds classical data into quantum states using various encoding techniques and trains a quantum-classical neural network. The quantum circuits in the network enable feature entanglement and transformations, facilitating a comparative analysis of the encoding methods. The Evaluator Module assesses the classification performance using standard metrics such as accuracy and F1-score, alongside quantum-specific metrics like fidelity and entanglement entropy, providing insights into the effectiveness of each encoding technique.

The hybrid model is designed to enhance feature representation and enable a detailed evaluation of encoding approaches for NIDS, addressing the limitations of traditional ML by incorporating quantum properties and metrics.

The algorithm used to evaluate the different encodings is detailed in (Algorithm 1) it takes the dataset as well as the different parameters as an input, the later parameters are used to configure the model by specifying the encoding technique as well as the VQC architecture, as well as preprocessing choices such as the dimensionality reduction technique (ANOVA or XGBoost). The algorithm outputs the model results in terms of classification metrics (accuracy, precision, F1-score, and recall) and quantum metrics (entanglement capability and expressibility).
**Algorithm 1 Quantum Encoding Evaluation Pipeline**

Require: Dataset $\mathcal{D}$, Circuit Configuration CircuitConfig

1: **Module01: Data Preprocessing**

2: **Function Clean_Data** (Input: Dataset $\mathcal{D}$ Output: Cleaned dataset)

3: Cleaned_Data ← RemoveDuplicates(Dataset $\mathcal{D}$)

4: Cleaned_Data ← HandleMissingValues(Cleaned_Data)

5: Cleaned_Data ← StandardizeFormats(Cleaned_Data)

6: **Return** Cleaned Data

7: **Function Reduce_Dimensionality** (Input: Cleaned Data, Technique (string: "ANOVA" or "XGBoost"), Number of Features $k$; Output: Dataset_with_selecte_d_features)

8: **if** Technique == "ANOVA" **then**

9: FeatureScores ← ComputeFValues(Cleaned_Data)

10: TopFeatures ← SelectTopKFeatures(FeatureScores, $k$)

11: **else if** Technique == "XGBoost" **then**

12: XGBModel ← TrainXGBoostModel(Cleaned_Data)

13: Importances ← GetFeatureImportance(XGBModel)

14: TopFeatures ← GetKFeatures(Importances, $k$)

15: **end if**

16: TrainData, TestData ← SplitDataset(percentage)

17: **Return** TrainData, TestData

18: **Module02: Model Training**

19: Encoder ← InitializeEncoding(CircuitConfig)

20: VQC ← InitializeVQC(CircuitConfig)

21: Model ← CreateModel(Encoder, VQC, Initialization)

22: Trained Model ← TrainModel(Model, TrainData)

23: **Module03: Model Evaluation**

24: Accuracy ← EvaluateAccuracy(TrainedModel, TestData)

25: F_score ← EvaluateF1_score(TrainedModel, TestData)

26: Recall ← EvaluateRecall(TrainedModel, TestData)

27: Precision ← EvaluatePrecision(TrainedModel, TestData)

28: Exp ← EvaluateExpressibility(Model)

29: Ent ← EvaluateEntanglementCapability(Model)

30: **return** Accuracy, F1_score, Recall, Precision, Exp, Ent

<figure><img src="image_3.png" /><figcaption>FIGURE 2. Modular overview of the proposed approach, comprising three primary modules—pre-processor Module, trainer module, and evaluator module.</figcaption></figure>

## A. PRE-PROCESSING MODULE

### 1) DATA CLEANING

To prepare the datasets for quantum machine learning, we implemented a preprocessing pipeline. First, data cleaning was performed to handle missing values, which were either imputed using the mean or removed when necessary. Categorical variables were converted to numerical formats

using one-hot encoding and all numerical characteristics were scaled to the range [0, 1] for consistency and compatibility with quantum encoding techniques.

### 2) DIMENSIONALITY REDUCTION

For feature selection, we used a hybrid approach that combined ANOVA (Analysis of Variance) and XGBoost. ANOVA was used to identify the features with the highest F-statistic values, ensuring statistical relevance, while XGBoost was used to compute feature importance scores based on model performance. This dual approach allowed us to significantly reduce the dimensionality of the datasets while preserving the most informative features for intrusion detection.

After feature selection, the retained features were normalized to unit norm, enabling seamless integration with quantum embeddings.

1) XGBoost: In order to reduce the size of our dataset, we have employed XGBoost [38], a gradient-boosting classifier of tree and forest-based learning algorithms. XGBoost constructs sequences of parallel decision trees, with each subsequent tree rectifying the errors of its predecessor. Mathematically, XGBoost aims to minimize the following objective function:

$$ \mathcal{L}(\theta) = \sum_{i=1}^{n} l(y_i, \hat{y}_i^{(t)}) + \sum_{k=1}^{t} \Omega(f_k) \quad (1) $$

where $l(y_i, \hat{y}_i^{(t)})$ is a differentiable convex loss function that measures the difference between the true label $y_i$ and the prediction $\hat{y}_i^{(t)}$ from the model at iteration $t$. The regularization term $\Omega(f_k)$ is defined to penalize the complexity of the trees and is expressed as:

$$ \Omega(f_k) = \gamma T + \frac{1}{2} \lambda \sum_{j=1}^{T} w_j^2 \quad (2) $$

where $T$ is the number of leaves in the tree $f_k$, $w_j$ is the weight assigned to the $j$-th leaf, and $\gamma$ and $\lambda$ are regularization parameters that control the trade-off between the model's accuracy and its complexity. In each iteration, XGBoost modifies the predictions by adding a new function $f_t$ that minimizes the objective. The predicted value $\hat{y}_i^{(t)}$ after $t$ iterations is given by:

$$ \hat{y}_i^{(t)} = \sum_{k=1}^{t} f_k(x_i) \quad (3) $$

where $f_k$ represents the decision tree added at each step. This iterative process allows the algorithm to assign greater weight to instances with higher errors, thus improving accuracy on significant samples.

2) Anova: Another feature selection method employed in this study is Analysis of Variance (ANOVA) [39], which serves to reduce dataset dimensionality and retain only significant features. ANOVA is a statistical method that compares means
between groups and helps in feature selection. It evaluates each variable to find those that contribute most to variance or have high discriminating potential. Each feature is assigned an F-value, which quantifies its ability to separate the data into distinct groups.

The F-value for a feature X is computed as the ratio of the mean square between groups (MSB) to the mean square within groups (MSW):

$$F = \frac{\text{MSB}}{\text{MSW}} \qquad (4)$$

where the mean squares are defined as:

$$\text{MSB} = \frac{\text{SSB}}{\text{dF}} = \frac{\sum_{k=1}^{K} n_k (\bar{X}_k - \bar{X})^2}{K - 1} \qquad (5)$$

$$\text{MSW} = \frac{\text{SSW}}{\text{dF}} = \frac{\sum_{k=1}^{K} \sum_{i=1}^{n_k} (X_{i,k} - \bar{X}_k)^2}{N - K} \qquad (6)$$

where:

* K is the number of groups,

* $n_k$ is the number of samples in group k,

* $\bar{X}_k$ is the mean of feature X within group k,

* $\bar{X}$ is the overall mean of feature X across all groups,

* $X_{i,k}$ is the i-th observation of feature X in group k,

* N is the total number of observations,

* dF = K - 1 is the degrees of freedom between groups,

* dF = N - K is the degrees of freedom within groups.

Thus, the F-value becomes:

$$F = \frac{\frac{\sum_{k=1}^{K} n_k (\bar{X}_k - \bar{X})^2}{K - 1}}{\frac{\sum_{k=1}^{K} \sum_{i=1}^{n_k} (X_{i,k} - \bar{X}_k)^2}{N - K}} \qquad (7)$$

The numerator represents the mean square between groups (MSB), indicating how much the means of the groups differ from the overall mean, while the denominator represents the mean square within groups (MSW), or the spread of observations within each group. Features with higher F-values have a greater ability to discriminate between groups, making them more valuable for classification tasks.

## B. TRAINER MODULE

### 1) CLASSICAL DATA EMBEDDING

In quantum computing, classical information in binary or numerical form is converted through a process called classic-quantum encoding. For this purpose, classical information points, which form vectors or matrices, should be transferred to a quantum system measured in qubits. The challenge is to encode classical data so that it can be processed by quantum circuits while preserving its information and meaning. The performance of quantum machine learning models to a great extent is dependent on the way the classical data is input to the quantum system. We studied our model using four different encoding methods, namely Angle Embedding, Amplitude Embedding, Instantaneous Quantum Polynomial Encoding (IQP), and

**QAOA Embedding**, to explore the impact of each approach on the model's performance.

* Angle Embedding: In the angle embedding [45] classical data is mapped into the angles of quantum gates, such as rotation gates, on qubits. Given a classical $x = (x_1, x_2, ..., x_n) \in \mathbb{R}^n$, it is encoded into a quantum state by applying rotational gates to the qubits. Each element $x_i$ of the vector is associated with a rotation on a qubit around a specific axis (commonly the y-axis or z-axis). The quantum state after applying Angle Embedding is represented as:

$$|\psi(x)\rangle = \bigotimes_{i=1}^{n} R_{\theta}(x_i)|0\rangle \qquad (8)$$

where $R_{\theta}(x_i)$ is a rotation gate that rotates the state $|0\rangle$ of the i-th qubit by an angle $\theta(x_i)$, where $\theta(x_i)$ is proportional to the value of $x_i$. For example, when using rotations around the y-axis, the rotation matrix $R_y(\theta)$ is:

$$R_y(\theta) = \begin{pmatrix} \cos(\theta/2) & -\sin(\theta/2) \\ \sin(\theta/2) & \cos(\theta/2) \end{pmatrix} \qquad (9)$$

To encode a vector $x$ with $n$ components, Angle Embedding requires exactly $n$ qubits, since each component $x_i$ of the vector corresponds to the rotation of one qubit. Hence the number of qubits that are needed increases in direct proportion to the size of the vector that needs to be encoded.

* Amplitude Embedding: The amplitude embedding [46] is a method for encoding classical data into quantum states by mapping the elements of a classical vector directly into the amplitudes of a quantum state. Given a classical $x = (x_1, x_2, ..., x_n) \in \mathbb{R}^n$, where the components $x_i$ represent the classical data points to be encoded, Amplitude Embedding creates a quantum state $|\psi(x)\rangle$ defined as follows:

$$|\psi(x)\rangle = \sum_{i=1}^{n} x_i |i\rangle \qquad (10)$$

Here, $|i\rangle$ represents the basis states of the quantum system, corresponding to the index of the components of the vector $x$. In this encoding, the coefficients $x_i$ are used as amplitudes, meaning that the state $|\psi(x)\rangle$ is a superposition of the basis states weighted by the values of the vector components. To encode a vector $x \in \mathbb{R}^n$ using Amplitude Embedding, the number of qubits required is:

$$\text{Lowest number of qubits} = \lceil \log_2(n) \rceil \qquad (11)$$

This means that if your vector has $n$ components, you need approximately $\log_2(n)$ qubits to represent it. An important step before is the vector normalization. For the amplitudes to form a valid quantum state, they
must be normalized. The sum of the squares of the magnitudes of the amplitudes must equal 1:

$$ \|\mathbf{x}\| = \sqrt{\sum_{i=1}^{n} |x_i|^2} \qquad (12) $$

If $\|\mathbf{x}\| \neq 1$, we normalize the vector using:

$$ \tilde{x}_i = \frac{x_i}{\|\mathbf{x}\|} \quad \text{for each } i = 1, 2, \dots, n. \qquad (13) $$

The normalized vector $\tilde{x}$ can then be used to form a valid quantum state $|\psi(\tilde{x})\rangle$.

* **Instantaneous Quantum Polynomial Encoding (IQP):** As introduced in [47] and implemented in pennylane framework, IQP encoding is a method used to encode classical data into quantum states using diagonal gates in an IQP circuit. This encoding maps classical vectors into quantum space while retaining their structure and interdependencies. Let $\mathbf{x} = (x_1, x_2, \dots, x_n)$ be a classical vector with $n$ components. In IQP encoding, each component $x_i$ is directly associated with a qubit, meaning that the number of qubits required, $m$, is equal to the number of features in the input data:

$$ m = n \qquad (14) $$

The encoding applies diagonal gates, such as controlled rotations or phase gates, to introduce interactions between the components of $\mathbf{x}$. These interactions can implicitly represent polynomial relationships between the features, enabling the encoding of higher-order dependencies without explicitly constructing all possible polynomial terms. In practice, the IQP circuit for $n$ features consists of the following steps:

1) **Initial State Preparation:** Initialize $m = n$ qubits to the ground state $|0\rangle^{\otimes m}$.

2) **Feature Encoding:** Apply parameterized diagonal gates, such as $R_Z(x_i)$ or controlled-phase gates, to encode the features $x_i$ into the quantum state.

This approach allows efficient encoding with $m = n$ qubits while capturing complex relationships between features.

* **Quantum Approximate Optimization Algorithm (QAOA) Embedding:** The QAOA Embedding encodes classical features into quantum states using a trainable quantum circuit inspired by the Quantum Approximate Optimization Algorithm (QAOA) ansatz, as described [48]. This approach is designed to map $N$ classical features into $n > N$ qubits using a layered architecture. Verdon et al. [40] present a quantum approximate optimization algorithm for continuous problems, which employs a dynamic approach by alternating evolution under two non-commuting Hamiltonians to optimize objective functions. The algorithm can be interpreted as performing gradient descent in superposition. This means that it updates the wave function in the direction of the local gradient while

maintaining a superposition of multiple starting points, allowing for simultaneous exploration of potential solutions. Each layer in the QAOA Embedding consists of two main components:

- **Feature-Encoding Circuit:** Classical features $\mathbf{x} = (x_1, x_2, \dots, x_N)$ are encoded into the quantum state using the rotation angles of $R_X$ gates. If the number of qubits $n$ exceeds the number of features $N$, the unused qubits are initialized with a Hadamard gate ($H$).

- **Variational Ansatz:** This component applies trainable operations inspired by a 1-dimensional Ising model:

1) Two-qubit interactions represented by the MultiRZ gate:

$$ e^{-i \frac{\alpha}{2} \sigma_z \otimes \sigma_z}, $$

where $\alpha$ is a trainable parameter.

2) Local fields applied using rotation gates:

$$ e^{-i \frac{\beta}{2} \sigma_{\mu}}, $$

where $\sigma_\mu$ can be $\sigma_x$, $\sigma_y$ (default), or $\sigma_z$. For $\sigma_y$, this corresponds to the $R_Y$ gate. $\beta$ is also a trainable parameter.

The trainable parameters $\alpha$ and $\beta$ are provided in the form of a weight matrix, weights, whose dimensions determine the number of layers $L$:

- (L, 1): For embeddings acting on a single wire.

- (L, 3): For embeddings acting on two wires.

- (L, 2n): For embeddings involving multiple qubits.

After applying $L$ layers of QAOA embedding, an additional set of feature encoding gates $R_X$ is applied to finalize the encoded quantum state. This layered architecture enables the efficient encoding and optimization of classical data for quantum machine learning applications.

Table 1 summarizes the benefits, shortcomings, and qubit requirements of the encoding techniques used in this work. While Amplitude Embedding and Angle Embedding are standard methods for encoding classical data into quantum states, IQP (Instantaneous Quantum Polynomial) and QAOA (Quantum Approximate Optimization Algorithm) are not inherently designed as data encoding techniques.

In this work, IQP and QAOA were adapted for encoding classical data into quantum states to explore their unique properties in the context of network intrusion detection. IQP circuits, known for their structured and noise-resilient gates, were leveraged to create quantum states that robustly encode classical features. Similarly, QAOA, typically used for optimization tasks, was repurposed to embed data by exploiting its parameterized circuit design, which allowed for flexibility and control during the encoding process. These adaptations were made to investigate how non-standard encoding approaches could impact model performance and resource efficiency.
<table><caption>TABLE 1. Comparison of encoding techniques.</caption><thead><tr><td>Technique</td><td>Qubits Required</td><td>Benefits</td><td>Shortcomings</td></tr></thead><tbody><tr><td>Amplitude Embedding</td><td>log<sub>2</sub>(n)</td><td>Efficient for high-dimensional data</td><td>Requires normalized inputs</td></tr><tr><td>Angle Embedding</td><td>n</td><td>Simple implementation</td><td>Limited expressiveness for complex data</td></tr><tr><td>IQP (adapted)</td><td>n</td><td>Potential noise resistance</td><td>Non-standard for data encoding</td></tr><tr><td>QAOA (adapted)</td><td>n</td><td>Leverages optimization properties</td><td>Non-standard for data encoding</td></tr></tbody></table>

<figure><img src="image_4.png" /><figcaption>FIGURE 3. Quantum circuit illustrating a layer of the *StronglyEntanglingLayers* structure with three qubits. The circuit includes single-qubit parametrized rotations $R_y$ and $R_z$, followed by CNOT gates in a specific entangling pattern: $q_1 \to q_2, q_2 \to q_3$, and $q_1 \to q_3$. This arrangement enables the creation of both local and global entanglement, enhancing the expressive power of variational quantum algorithms.</figcaption></figure>

<figure><img src="image_5.png" /><figcaption>FIGURE 4. Quantum circuit illustrating a layer of the *BasicEntanglingLayers* structure with three qubits. Each qubit is subjected to parametrized single-qubit rotations $R_x$ and $R_z$, followed by a single CNOT gate creating local entanglement between adjacent qubits ($q_1$ and $q_2$). This design prioritizes simplicity while maintaining the ability to represent correlations within neighboring qubits, ideal for localized quantum interactions.</figcaption></figure>

## 2) CLASSIFIER TRAINING

Interleaving layers in quantum machine learning models use superposition and entanglement to help quantum circuits represent complex data relationships. We studied circuits with different levels of entanglement to explore its impact on model performance and accuracy. We opted for two circuits representing two different levels of entanglement.

Strongly Entangling Layers (Figure 3) [41] are a quantum circuit architecture used in quantum machine learning and quantum algorithms. These layers consist of an alternation between single-qubit rotations and entangling gates applied to pairs of qubits. The single-qubit rotations typically involve three types of gates: $R_y$, $R_z$, $R_x$, applied sequentially to each qubit. These rotations explore the quantum state space by adjusting the amplitude and phase of each qubit. The entangling gates, on the other hand, play a critical role in generating quantum correlations between qubits. Commonly used gates include CNOT (Controlled-NOT) and CZ (Controlled-Z), which follow a predefined entanglement pattern. A distinguishing feature of Strongly Entangling Layers is their adjustable entanglement structure. Each qubit is connected to another qubit at a distance $r$, where $r$ is referred to as the entanglement range. This configuration introduces a controllable level of complexity in the system by modulating the interactions between qubits as needed. The flexibility of Strongly Entangling Layers makes them highly adaptable to various applications. The number of layers, the types of gates employed, and the entanglement range $r$ can be tailored to balance the trade-off between circuit complexity and the computational resources required. Moreover, this approach enables the generation of complex quantum states using a limited number of gates, making it particularly suitable for hardware platforms constrained by circuit depth or noise. The unitary transformation of the layer

can be written as follows:

$$U(\theta) = \prod_{j=1}^{n} (R_y(\theta_j^y) R_z(\theta_j^z)) \prod_{\langle i,j \rangle} \text{CNOT}_{i,j} \quad (15)$$

where $R_y$ and $R_z$ are the parameterized rotations to the qubits $j$, and CNOT gates are applied between qubits pairs.

The Basic Entangler Layers (Figure 4) are quantum circuit layers designed to create simple and local entanglement between qubits. Each qubit undergoes an individual unitary rotation (often $R_y(\theta_j)$), followed by a CNOT gate applied only between neighboring qubits, restricting entanglement to adjacent qubits.

Mathematically, for a system of $n$ qubits, the operation performed is described by:

$$U(\theta) = \prod_{j=1}^{n} R(\theta_j) \prod_{\langle i,j \rangle} \text{CNOT}_{i,j} \quad (16)$$

The unitary transformation $U(\theta)$ is constructed by sequentially applying two operations: local rotations and controlled entanglement gates. First, each qubit undergoes a single-qubit rotation $R_y(\theta_j)$, which is parameterized by $\theta_j$ and acts independently on each qubit, contributing to the product $\prod_{j=1}^n R_y(\theta_j)$. Second, CNOT gates are applied between neighboring qubits to introduce local entanglement, forming the product $\prod_{\langle i,j \rangle} \text{CNOT}_{i,j}$, where $\langle i,j \rangle$ represents adjacent qubit pairs. The combination of these two steps defines the overall unitary operation, where the single-qubit rotations encode the parameters and the CNOT gates ensure correlations between adjacent qubits, resulting in the mathematical expression for $U(\theta)$.

In summary, BasicEntanglerLayers and StronglyEntanglerLayers are two types of layers used in quantum circuits, but they differ mainly in their structure
and the way they entangle qubits. BasicEntanglerLayers are characterized by their simplicity. They apply two-qubit gates sequentially to create linear entanglement between adjacent qubits. This means that the connections between qubits are limited, making them efficient for quantum architectures where interactions are restricted. However, StronglyEntanglingLayers offer a more complex and robust configuration. Each qubit undergoes single-qubit operations combined with entanglement gates involving multiple other qubits, enabling a denser entanglement network. This allows for better propagation of quantum information, which is useful in circuits requiring strong correlations between qubits. BasicEntanglerLayers prioritize simplicity and are suitable for simple topologies, while StronglyEntanglingLayers aim for stronger connectivity, making them better suited for tasks demanding higher quantum correlations.

### 3) ESSENTIAL LEARNING COMPONENTS IN THE HYBRID QUANTUM-CLASSICAL MODEL

In this section, we examine the principles of hybrid quantum-classical learning, with a particular focus on mechanisms that enhance efficiency in binary classification. The discussion will analyze how each component of this model contributes to optimizing the accuracy and stability of the training process, which is crucial for network intrusion detection.

**Initializing Quantum Weights:** Proper weight initialization has been crucial in both classical and quantum neural networks for expeditious and stable convergence during training. In the present case, the weights associated with the quantum layer are initialized randomly within the interval $[-\pi, \pi]$. This variation in the uniform distribution ensures that each qubit rotation starts with random amplitude and angle. This helps explore a wide range of data representations at the start of training. It also prevents starting rotations at extreme angles, which could slow down or affect model convergence.

In the hybrid quantum-classical model, measurement and conversion into classical format are key steps. They transform information from quantum space into data usable in the classical domain. After encoding input features into quantum states, the quantum circuit processes them using spin and entanglement gates. Each qubit then holds complex information about the original data. However, this information exists in probabilistic states that cannot be directly observed. The measurement process extracts this data and makes it interpretable in the classical framework. The measurement process consists of observing a quantum observable with the Pauli-Z operator, for each qubit. This operator is selected because it defines a straightforward framework: by measuring each qubit concerning this observable, we obtain values between -1 and 1, representing the probabilities of finding each qubit in the $|0\rangle$ state (value +1) or the $|1\rangle$ state (value -1).

A single measurement cannot accurately capture the quantum state because it is probabilistic. To solve this, we

measure the state multiple times to calculate the expected value of the observable. This means running the circuit several times and averaging the results for each qubit.

After calculating the expectation value for each qubit, we get a set of classical values. These values are a transformed version of the input features, enriched by the quantum circuit. This classical vector is then sent to the classical layers, like dense layers, for processing and prediction. The measurement process converts complex quantum information into a classical format. This allows the model to process the data and produce an interpretable output, such as a classification probability.

The dense layer converts the outputs of the quantum circuit into binary predictions. For example, if the output of the quantum layer is a feature vector $\mathbf{z} = [z_1, z_2, \dots, z_n]$, The dense layer with a sigmoid activation function produces an output probability $p$ given by:

$$p = \sigma(\mathbf{w}^T \mathbf{z} + b) = \frac{1}{1 + e^{-(\mathbf{w}^T \mathbf{z} + b)}} \quad (17)$$

where $\sigma(x)$ is the sigmoid function, $\mathbf{w}$ is the weight vector of the dense layer, and $b$ is the associated bias. This probability $p$ is interpreted as the likelihood of belonging to class 1 (e.g., DDoS attack), while $1-p$ corresponds to class 0 (benign traffic). This transformation maps the output between 0 and 1, facilitating binary classification in probabilistic terms.

The Adam optimizer adjusts the weights to minimize the loss function. For each iteration, Adam adapts the learning rate for each weight based on the first and second moments of the gradients. If $g_t$ is the gradient of the loss for a weight $w$ at iteration $t$, Adam computes the moving averages $\mathbf{m}t_{hat}$ (moment of gradients) and $\mathbf{v}t_{hat}$ (moment of squared gradients):

$$\mathbf{m}t_{hat} = \beta_1 \mathbf{m}t_{hat-1} + (1 - \beta_1) g_t \quad (18)$$

$$\mathbf{v}t_{hat} = \beta_2 \mathbf{v}t_{hat-1} + (1 - \beta_2) g_t^2 \quad (19)$$

where $\beta_1$ and $\beta_2$ are decay rates (commonly set to 0.9 and 0.999, respectively). The weight is then updated as follows:

$$\mathbf{w}_{t+1} = \mathbf{w}_t - \frac{\eta}{\sqrt{\mathbf{v}t_{hat} + \epsilon}} \cdot \mathbf{m}t_{hat} \quad (20)$$

with a small $\epsilon$ added to prevent division by zero, and $\eta$ being the initial learning rate. This method allows for more stable and faster convergence, especially in quantum hybrid models where gradients may vary complexly.

Binary cross-entropy ($\mathcal{L}$) evaluates the quality of the prediction by comparing the probability that the model assigns to a class with the actual label of each data example. Binary cross-entropy aims to minimize the error between the predicted probability and the actual value for each sample, which amounts to maximizing the model's certainty in its predictions. The function is defined as follows:

$$\mathcal{L} = -\frac{1}{N} \sum_{i=1}^{N} [y_i \log(p_i) + (1 - y_i) \log(1 - p_i)] \quad (21)$$
where N is the total number of samples in the data set, $y_i$ is the actual value for the i-th sample (0 or 1), $p_i$ is the probability predicted by the model that the sample i belongs to the positive class.

The cross-entropy function is applied to the error, significantly penalizing values that deviate from the true values. For instance, if the model assigns a very high probability (approaching 1) for a sample belonging to class 0, then the loss value must be correspondingly high, indicating a substantial classification error. Conversely, if the model assigns a very low probability (approaching 0) for an instance of class 1, it will also incur a penalty. By minimizing this loss function, we compel the model to adjust its parameters, thereby aligning it more closely with the true labels of the input element. This principle implies that at each iteration, the Adam optimizer modifies the network weights to minimize the error between the predicted probabilities and the actual values.

### C. EVALUATOR MODULE

This module represents an important component of our contribution, it deals with the evaluation of the performance metrics for the different QNN architectures. We evaluated by the selection of different evaluation metrics that can significantly influence the interpretation of model performances hence influencing the effects of the embedding in question on the classification task. To achieve a comprehensive evaluation, we analyze the models' performance from two distinct angles: classical classification metrics and quantum-specific metrics. The classification performance is assessed through well-established metrics, each selected for its relevance in quantifying different aspects of the model's accuracy and reliability. For instance, accuracy provides a general measure of correctness, while precision and recall offer more detailed insights into the model's capability to identify true positives, thus minimizing false positives and false negatives. The F1 score combines precision and recall into a single value, particularly useful in situations where balancing these two aspects is crucial. These metrics collectively form the foundation for evaluating how effectively the model performs its primary classification task.

We also look at the confusion matrix, which breaks down results into true positives, false positives, true negatives, and false negatives. This helps us see where the model makes specific types of errors. Together, these metrics give a well-rounded picture of how well the model performs its main classification task.

In addition to classical metrics, quantum metrics are introduced to capture quantum-specific characteristics of the model's behavior. The expressibility and the entanglement capability are the two chosen metrics for this part of the metrics, below is a brief definition of the two metrics.

**Expressibility:** The expressibility [49] quantifies the ability of a variational quantum circuit (VQC) to explore the Hilbert space. For a single qubit, a highly expressible VQC is capable of exploring the entire Bloch sphere uniformly.

The degree of uniformity is quantified by randomly sampling parameters $\theta$ of the VQC and calculating the Kullback-Leibler divergence (DKL) relative to the ensemble of Haar-random states. If a circuit is highly expressible, this distance is small. Expressibility is defined as follow:

$$ \text{Expr} = D_{\text{KL}}(\hat{P}_{\text{VQC}}(F; \theta) \| P_{\text{Haar}}(F)) \quad (22) $$

where the fidelities $F$ are obtained by uniformly sampling pairs of parameter vectors and computing their corresponding state overlap. $\hat{P}_{\text{VQC}}(F; \theta)$ is the estimated probability distribution of fidelities obtained from the VQC, and $P_{\text{Haar}}(F)$ is the known probability distribution for Haar-random states, given analytically by

$$ P_{\text{Haar}}(F) = (N - 1)(1 - F)^{N-2}. \quad (23) $$

**Entanglement Capability:** The entanglement capability [49] of a VQC is measured using the Meyer-Wallach (MW) entanglement measure, which assesses how effectively the circuit can generate entangled quantum states. The measure is zero if the circuit produces product states (i.e., no entanglement) and one if the circuit exclusively generates maximally entangled states. The MW measure is defined as:

$$ Q(|\psi\rangle) = \frac{4}{N} \sum_{j=1}^{N} D(\iota_j(0)|\psi\rangle, \iota_j(1)|\psi\rangle) \quad (24) $$

where $N$ is the number of qubits, and $\iota_j(b)$ is a linear map acting on the computational basis state (with $b \in \{0, 1\}$) that removes the $j$-th qubit. This operation is defined using the Kronecker delta as follows:

$$ \iota_j(b)|b_1 \dots b_N\rangle = \delta_{b,b_j}|b_1 \dots b_{j-1}b_{j+1} \dots b_N\rangle \quad (25) $$

The generalized distance $D$ between two quantum states $|u\rangle$ and $|v\rangle$ is calculated as:

$$ D(|u\rangle, |v\rangle) = \frac{1}{2} \sum_{i,j} |u_i v_j - u_j v_i|^2 \quad (26) $$

The final estimate of the entanglement capability is obtained by averaging the MW measure over a set $S$ of sampled parameter vectors $\theta_i$, as given by:

$$ \text{Ent} = \frac{1}{|S|} \sum_{\theta_i \in S} Q(|\psi_{\theta_i}\rangle) \quad (27) $$

The intersection of classical and quantum perspectives allows for a holistic analysis that merges the strengths of both paradigms. By comparing results from classical and quantum metrics, we can identify synergies and trade-offs that arise when integrating these approaches. This intersection highlights scenarios where classical metrics may fail to capture the unique quantum behaviors embedded in the model or where quantum metrics reveal new dimensions of data representation that classical metrics overlook. Thus, the overlap not only strengthens our understanding of model performance but also underscores the value of a hybrid evaluation framework in achieving a balanced perspective on classification results.
<table><caption>TABLE 2. Comparative analysis of EdgeIoT and CIoT2023 datasets for network intrusion detection.</caption><thead><tr><th>Aspect</th><th>Dataset 1: EdgeIoT</th><th>Dataset 2: CIoT2023</th></tr></thead><tbody><tr><td>Data Type</td><td>Network Packets</td><td>Network Flows</td></tr><tr><td>Labels</td><td>Binary (Class 0: Normal, Class 1: Attack)</td><td>Binary (Class 0: Normal, Class 1: Attack)</td></tr><tr><td>Primary Focus</td><td>Wide range of attack types (multi-vector threats)</td><td>Primarily DDoS-specific attack types</td></tr><tr><td>Attack Types</td><td>MITM, Fingerprinting, Ransomware, SQL Injection, DDoS (HTTP, TCP, UDP, ICMP), Password Attacks, Port Scanning, Vulnerability Scanner, Backdoor, XSS</td><td>DDoS-HTTP Flood, DDoS-SYN Flood, DDoS-PSHACK Flood, DDoS-RSTFIN Flood</td></tr><tr><td>Number of Features</td><td>61</td><td>38</td></tr><tr><td>Classification Approach</td><td>Binary classification: Benign vs. Attack</td><td>Binary classification: Benign vs. Specific DDoS Attacks</td></tr><tr><td>Objective of Classification</td><td>Generalized malicious behavior detection</td><td>Specialized detection of DDoS attacks</td></tr><tr><td>Granularity Level</td><td>Individual Packets</td><td>Aggregated Network Flows</td></tr></tbody></table>

# IV. IMPLEMENTATION AND RESULTS

In this section, we provide a comprehensive overview of the dataset and the tools utilized for the model implementation. We then present the results obtained by evaluating the model's performance across different configurations, highlighting the impact of these variations on the key metrics.

The implemented code is publicly available on github.<fnref n="3" />

## A. DATASETS

As part of our experiments on quantum encoding for our model, we selected two public datasets: CIoT2023 [42] and EdgeIoT [43]. These datasets, presented in Table 2, were used to test the performance of our approaches on two different types of data: network flows and network packets. The first dataset, referred to as “Dataset 1”, comes from EdgeIoT and represents network packets. This dataset is labeled in a binary manner, with class 0 corresponding to packets from normal interactions and class 1 representing packets associated with attacks. These attacks vary and include: MITM, Fingerprinting, Ransomware, SQL Injection, DDoS-HTTP, DDoS-TCP, Password Attacks, Port Scanning, Vulnerability Scanner, Backdoor, XSS, DDoS-UDP, and DDoS-ICMP. The dataset contains 61 features that model different aspects of the captured packets. The second dataset, named “Dataset 2”, is derived from CIoT2023 and focuses on network flows. Similar to the first dataset, it is labeled in a binary manner, with class 0 indicating flows from normal interactions and class 1 indicating flows resulting from attacks. In this case, the attacks are primarily DDoS types, including the following variants: DDoS-HTTP Flood, DDoS-SYN Flood, DDoS-PSHACK Flood, and DDoS-RSTFIN Flood. This dataset consists of 38 features, offering a detailed view of the network flows under study. The binary classification approach with two distinct types of scenarios enables us to assess our model's capability in the face of a variety of attacks. In the first case, by classifying benign traffic in the face of a diverse set of threats (MITM, Fingerprinting, Ransomware, SQL Injection, DDoS, password attacks, etc.), we test our model's ability to identify a wide range of malicious behavior, which is essential for

an IoT environment exposed to multiple attack vectors. In the second case, by limiting the binary classification to benign traffic and specific DDoS attacks (HTTP Flood, SYN Flood, PSHACK Flood, and RSTFIN Flood), we assess the model's specialization in detecting DDoS attacks, analyzing its accuracy and sensitivity in the face of this particularly complex and damaging type of network threat. By doing so, we can identify the model's strengths and limitations for generalized attack scenarios, as well as for specific high-severity situations such as DDoS. This approach offers a more comprehensive assessment of the robustness and accuracy of our detection system. Analyzing both packets and network flows simultaneously enables the detection of anomalies at a granular level (individual packets) and an aggregated level (overall flows), providing a more comprehensive and accurate view of potentially malicious behaviors. The two distinct types of scenarios involved in the binary classification approach will enable a comprehensive assessment of the model's capability against various types of attacks. We evaluate the efficacy of our model in identifying a wide range of malicious behavior and classifying benign traffic in the presence of diverse threats which is crucial for an IoT environment exposed to multiple attack vectors. In the second case, by narrowing the binary classification to solely benign traffic and specific DDoS attacks, namely HTTP Flood, SYN Flood, PSHACK Flood, and RSTFIN Flood, we examine the model's specialization in detecting DDoS attacks, considering its accuracy and sensitivity in the face of this particularly complex and damaging typology of network threat. This approach will, consequently, allow for the identification of the model's strengths and weaknesses concerning generalized attack scenarios and specific high-severity situations, such as DDoS. It provides a more comprehensive review of the robustness and accuracy of our detection system.

The preprocessing step of reducing dimensionality is essential when implementing QML in practice. Given that current quantum algorithms are limited in scale (both in terms of qubit and circuit depth), they cannot be directly applied to process high-dimensional datasets. This dimensionality reduction process introduces the data to a technique that adapts them to processing by quantum algorithms while

<footnote n="3">³https://github.com/ReSEC-Laboratory/QIDS</footnote>
<table><caption>TABLE 3. Feature importance ranking: The first dataset (CIC-IoT-2023) scores were obtained using XGBoost, while the second dataset (IoT-Edge) scores were derived using ANOVA variance analysis.</caption><thead><tr><td>Rank (XGBoost)</td><td>Feature (XGBoost)</td><td>Importance (XGBoost)</td><td>Rank (ANOVA)</td><td>Feature (ANOVA)</td><td>Normalized Score (ANOVA)</td></tr></thead><tbody><tr><td>1</td><td>cwr_flag_number</td><td>0.0878</td><td>1</td><td>mqtt.hdrflags</td><td>1.0000</td></tr><tr><td>2</td><td>SSH</td><td>0.0111</td><td>2</td><td>mqtt.msgtype</td><td>1.0000</td></tr><tr><td>3</td><td>Min</td><td>0.0023</td><td>3</td><td>mqtt.len</td><td>0.8586</td></tr><tr><td>4</td><td>HTTP</td><td>0.0019</td><td>4</td><td>tcp.seq</td><td>0.8375</td></tr><tr><td>5</td><td>IGMP</td><td>0.0017</td><td>5</td><td>tcp.dstport</td><td>0.6686</td></tr><tr><td>6</td><td>Telnet</td><td>0.0014</td><td>6</td><td>mqtt.conflags</td><td>0.4910</td></tr><tr><td>7</td><td>Protocol Type</td><td>0.0013</td><td>7</td><td>mqtt.ver</td><td>0.4910</td></tr><tr><td>8</td><td>rst_flag_number</td><td>0.0012</td><td>8</td><td>mqtt.protolen</td><td>0.4910</td></tr><tr><td>9</td><td>ARP</td><td>0.0012</td><td>9</td><td>mqtt.conflag.cleansess</td><td>0.4910</td></tr><tr><td>10</td><td>Rate</td><td>0.0010</td><td>10</td><td>mqtt.protoname</td><td>0.4910</td></tr></tbody></table>

preserving the majority of relevant information, thereby enhancing the efficiency of the QML model. The reduction in the number of parameters also inherently decreases noise and computational complexity, which results in more stable and accurate encoding of data to quantum circuits, consequently yielding improved classification and anomaly detection outcomes.

## B. EXPERIMENTAL SETUP

In our experimental approach, we used several essential libraries to implement and test quantum encodings on our hybrid quantum-classical model. Keras, Scikit-learn, PennyLane, and Google Colab are the essential libraries for our approach, each having a role to play in enabling efficient modeling and testing in a controlled environment. Keras has facilitated the development of a flexible framework integrated with TensorFlow, which is extensively utilized in research for the design and training of neural networks. It enables the creation of neural network models and their customization through the incorporation of quantum layers. The Keras API simplifies the construction of classical neural networks while offering the capability to include quantum components, which is particularly pertinent to our hybrid approach. Scikit-learn was utilized for data pre-processing and model evaluations. This library is designed for classical machine learning tasks and provides tools for normalizing and partitioning datasets into training and test samples. Scikit-learn was also employed to evaluate the performance of our model, facilitating direct comparisons of accuracy, loss, and other performance metrics. PennyLane was instrumental in our quantum approach, facilitating the creation and simulation of quantum circuits for our model. This library is utilized in part to leverage the potential of quantum computing in machine learning. Specifically, PennyLane has enabled the evaluation of various encoding methods, such as Angle Embedding and QAOA Embedding, and the implementation of diverse quantum circuits, including Strongly Entangling Layers and Basis Entangler Layers. PennyLane facilitates the optimization of diverse quantum circuits through the integration of classical quantum circuit optimization techniques, such as backpropagation, for the computation of quantum circuit gradients. The framework accommodates

both qubit and continuous variable quantum devices and exhibits compatibility with various quantum simulators and hardware through a plugin system, including those from Xanadu Cloud, Amazon Braket, and IBM Quantum [44]. For our setup, we used PennyLane's default.qubit simulator, which is a Python-based vector state simulator, allowing full backpropagation and easy integration with machine learning libraries such as TensorFlow and PyTorch. This enabled us to define quantum nodes (QNodes) and optimize quantum circuit parameters efficiently. For our experimental setup, we utilized PennyLane's default.qubit simulator, a Python-based vector state simulator that facilitates full backpropagation and seamless integration with machine learning libraries such as TensorFlow and PyTorch. This configuration enabled the definition of quantum nodes (QNodes) and efficient optimization of quantum circuit parameters. Google Colab served as a development platform, offering a notebook environment for interactive, collaborative work. The experiments were carried out on a Google Colab computing environment with 13.6 GB of RAM. The processor used is a 2.2 GHz Intel Xeon with 1 physical core and two threads. The level 3 CPU cache is 56 MB, and the architecture supports AVX2 and SSE4.2 instructions, enabling certain mathematical operations to be optimized. The environment is virtualized, which may introduce limitations linked to shared execution contexts.

## C. PERFORMANCE RESULTS

The initial step involved reducing the dimensionality of the dataset, retaining only the most salient features, before proceeding to the quantum processing phase. Table 3 presents the feature importance rankings for two datasets: CIC-IoT-2023 (using XGBoost) and IoT-Edge (using ANOVA variance analysis). This selection is predicated on several factors: primarily, quantum models are currently constrained by the number of available qubits and the complexity associated with managing high-dimensional information.

By selecting only those features that exert a significant influence on classification performance, we optimize the efficiency of the quantum algorithm while minimizing potential noise attributable to irrelevant variables. In this study, we utilized an XGBoost model to evaluate and rank
<figure><img src="image_6.png" /><figcaption>**FIGURE 5.** Performance of a Quantum Neural Network using Angle Embedding for data encoding and StronglyEntanglingLayers in a binary classification task on CIClimate2023. The model was trained for 5 epochs with a batch size of 50. The graph illustrates the accuracies achieved with different rotation angles applied during the encoding process and the corresponding measurement types used for the quantum operations.</figcaption></figure>

the importance of diverse features, which were subsequently classified based on their contribution to the information critical for network flow categorization.

Table 4 compares the performance of different quantum embeddings on two datasets (Edge IoT and CIC-IDS) using two types of entanglement layers (Strongly Entangled and Basic Entangled). The performance metrics used are accuracy, precision, F1-score, and recall. The results show that the choice of quantum encoding has a strong impact on the performance of variational quantum models (VQC). Amplitude Embedding performs well overall, showing stability and high accuracy on both datasets, regardless of the type of interleaving used. It achieves competitive accuracy and F1-score on the Edge IoT dataset and remains robust on the CIC-IDS dataset. Angle Embedding performs slightly better than Amplitude Embedding in some cases, especially with highly interleaved layers on the Edge IoT dataset. However, it is less suitable for the CIC-IDS dataset, where its performance is lower. IQP Embedding shows mixed results. It performs worse in many scenarios, suggesting that it has limited adaptation to the data structures analyzed. QAOA Embedding performs very well on complex datasets like CIC-IDS. It achieves nearly perfect scores with weakly interlaced layers, showing its ability to capture complex relationships in the data.

Figure 6 illustrates the evolution of accuracy during training in multiple epochs for four quantum encoding

<figure><img src="image_7.png" /><figcaption>**FIGURE 6.** Comparison of accuracy over epochs on CIClimate2023 Dataset for four different quantum encoding techniques: Angle Embedding, Amplitude Embedding, IQP Embedding, and QAOA Embedding. The graph illustrates the performance of each encoding method in a binary classification task, with accuracy values plotted across 10 epochs. The number of layers is fixed at 8 for all models.</figcaption></figure>

methods: Angle Embedding, Amplitude Embedding, IQP Embedding, and QAOA Embedding. An epoch represents a complete pass through the entire training dataset, during which the model updates its parameters to reduce prediction errors. Over successive epochs, the model learns patterns in the data, improving its performance. Amplitude Embedding and QAOA Embedding are the encodings that perform the best. Amplitude Embedding shows a rapid improvement in accuracy, indicating its effectiveness in capturing complex patterns from the early iterations. QAOA Embedding also
<table><caption>TABLE 4. Comparison of quantum embeddings on VQC performance: Accuracy, precision, F1 score, and recall.</caption><thead><tr><th>Metrics</th><th>Amplitude Embedding</th><th>Angle Embedding</th><th>IQP Embedding</th><th>QAOA Embedding</th></tr></thead><tbody><tr><td colspan="5" style="text-align:center; font-weight:bold;">Edge IoT Dataset</td></tr><tr><td colspan="5" style="text-align:center; font-weight:bold;">Strongly Entangled Layers</td></tr><tr><td>Accuracy</td><td>0.854</td><td><strong>0.857</strong></td><td>0.854</td><td><strong>0.788</strong></td></tr><tr><td>Precision</td><td><strong>0.858</strong></td><td>0.856</td><td>0.854</td><td>0.858</td></tr><tr><td>F1-score</td><td>0.920</td><td><strong>0.922</strong></td><td>0.921</td><td><strong>0.880</strong></td></tr><tr><td>Recall</td><td>0.922</td><td><strong>1.0</strong></td><td>1.0</td><td><strong>0.902</strong></td></tr><tr><td colspan="5" style="text-align:center; font-weight:bold;">Basic Entanglement Layers</td></tr><tr><td>Accuracy</td><td><strong>0.868</strong></td><td>0.852</td><td>0.797</td><td>0.860</td></tr><tr><td>Precision</td><td><strong>0.865</strong></td><td>0.850</td><td>0.849</td><td>0.858</td></tr><tr><td>F1-score</td><td><strong>0.928</strong></td><td>0.919</td><td>0.884</td><td>0.923</td></tr><tr><td>Recall</td><td><strong>1.0</strong></td><td>1.0</td><td>0.922</td><td>0.999</td></tr><tr><td colspan="5" style="text-align:center; font-weight:bold;">CIC-IDS Dataset</td></tr><tr><td colspan="5" style="text-align:center; font-weight:bold;">Strongly Entangled Layers</td></tr><tr><td>Accuracy</td><td>0.952</td><td><strong>0.516</strong></td><td>0.678</td><td><strong>0.979</strong></td></tr><tr><td>Precision</td><td>0.912</td><td><strong>0.499</strong></td><td>0.608</td><td><strong>0.962</strong></td></tr><tr><td>F1-score</td><td><strong>0.953</strong></td><td>0.66</td><td>0.752</td><td>0.98</td></tr><tr><td>Recall</td><td>0.998</td><td>0.976</td><td>0.985</td><td><strong>0.999</strong></td></tr><tr><td colspan="5" style="text-align:center; font-weight:bold;">Basic Entanglement Layers</td></tr><tr><td>Accuracy</td><td>0.96</td><td><strong>0.536</strong></td><td>0.567</td><td><strong>0.994</strong></td></tr><tr><td>Precision</td><td>0.954</td><td>0.511</td><td>0.722</td><td><strong>0.989</strong></td></tr><tr><td>F1-score</td><td>0.96</td><td>0.672</td><td>0.378</td><td><strong>0.994</strong></td></tr><tr><td>Recall</td><td>0.967</td><td><strong>0.981</strong></td><td>0.256</td><td>0.998</td></tr></tbody></table>

<figure><img src="image_8.png" /><figcaption>(a) BasicEntanglerLayers</figcaption></figure>

<figure><img src="image_9.png" /><figcaption>(b) StrongEntanglingLayers</figcaption></figure>

<caption>FIGURE 7. Comparison of accuracy across varying layer depths for different data encoding methods applied to quantum circuits with BasicEntanglerLayers and StrongEntanglingLayers architectures on CICIoT2023 dataset. During training, fixed hyperparameters included a batch size of 50, a learning rate optimized with the Adam optimizer, and 5 epochs per configuration. The depth of each circuit was adjusted between 1 and 12 layers to evaluate the impact on model performance, with accuracy generally increasing with greater depth, particularly for QAOA Embedding and Amplitude Embedding.</caption>

demonstrates a steady progression, with performance surpassing that of IQP Embedding, which shows more variable results but a gradual improvement over epochs.

Figure 8 shows how the validation accuracy changes with the number of qubits and features for two datasets: CICIoT2023 and EdgeIoT. The results reveal clear differences in how hybrid quantum-classical models perform on the basis of dataset. The CICIoT2023 dataset, focused on detecting DDoS attacks, shows a steady increase in accuracy as the number of qubits and features grows. With 2 qubits (4 features), the accuracy starts at 85%.

Adding more qubits improves performance, reaching a maximum accuracy of 89% with 4 qubits (16 features). This improvement reflects the model's ability to learn distinctive patterns from the aggregated network flow data. The EdgeIoT dataset, designed for detecting diverse threats, shows lower performance. With 2 qubits (4 features), the accuracy is 70%. Adding more qubits results in only slight improvements, reaching 73% with 4 qubits (16 features). Several factors explain this result. EdgeIoT includes various attack types, such as MITM, ransomware, and SQL injection. This diversity makes it harder for the model to identify
<figure><img src="image_10.png" /><figcaption>FIGURE 8. Accuracy as a function of the number of qubits and features for the CICIoT2023 and EdgeloT datasets. The encoding used is Amplitude Embedding with a circuit based on StronglyEntanglingLayers. The optimization uses Adam, a binary cross-entropy loss function with 10 epochs and a batch size of 50.</figcaption></figure>

common patterns. Additionally, EdgeIoT uses individual network packets, which provide less information compared to the aggregated network flows in CICIoT2023. This limits the model's ability to detect complex correlations. The diversity of attack types and the granularity of the data also introduce noise, reducing classification effectiveness. The results confirm that aggregated data, like in CICIoT2023, is better for quantum learning models when detecting specific attacks such as DDoS. This comparison highlights the need to match data and model choices to the application. For tasks like DDoS detection, highly representative and aggregated data are more effective.

Figure 7 presents the evaluation of model accuracy for various numbers of layers, using different methods of encoding classical data into quantum format. The hyper-parameter defining the number of layers represents the count of variational layers in the quantum circuit, which include parameterized gates (such as rotations) and entangled connections between qubits (typically implemented with controlled gates). The results show that increasing the number of layers generally improves the model's accuracy up to a certain threshold, emphasizing the importance of circuit depth in capturing complex data patterns. For Angle Embedding, however, the accuracy gains are minimal with additional layers, suggesting that this encoding method quickly reaches its capacity to capture intricate relationships in the data, even as circuit depth increases. To enhance the performance of Angle Embedding and hybrid quantum models, optimizing the use of specific rotations is essential. These rotations effectively project classical data into the quantum space, while measurements are critical for extracting relevant quantum state information. Together, these processes improve data representation and maximize class separation for better classification outcomes.

Figure 5 shows the results of applying quantum rotations and measurements in circuits for binary classification using Angle Embedding as the encoding method. This method encodes each feature as a rotation angle applied to qubits, allowing the model to capture complex relationships in the data using superposition and entanglement.

The results highlight that combining Y-axis rotations with measurements in the Pauli-X or Pauli-Y bases achieves the best accuracy, reaching 93.08% on the validation set. This indicates that Y rotations improve data separation in the Hilbert space, making classification more efficient. In contrast, configurations like Z rotations measured in the Pauli-X basis perform poorly, with accuracy stagnating around 50%, similar to random predictions. These differences arise from the interaction between the encoding method, the rotations applied, and the measurement bases chosen. For instance, Y rotations better exploit qubit entanglement, which helps detect complex patterns in the data. In hybrid quantum models, the choice of rotations and measurements is critical for model performance. Measurements extract classical information from quantum states, while rotations encode classical features into qubits. Measurements such as PauliX, PauliY, PauliZ, and Hadamard influence how data patterns are represented and recognized. Rotations like X, Y, and Z determine how classical data is mapped into the quantum space. Selecting the right combination of these operations ensures the model can effectively classify data, such as in tasks like network intrusion detection.

Figure 9 (a) and (b) illustrate the evaluation of entanglement capability and expressibility, respectively. Amplitude Embedding demonstrates high entanglement and low expressibility, making it particularly effective for intrusion detection in network traffic classification. Its strength lies in modeling complex correlations and efficiently representing the target distribution. Angle Embedding also shows strong
<figure><img src="image_11.png" /><figcaption>FIGURE 9. Encoding method expressibility and entanglement capability as a function of the number of layers.</figcaption></figure>

performance in terms of entanglement capability, although
its expressibility is less optimal compared to Amplitude
Embedding. This makes it a viable alternative in scenarios
where computational precision is less critical. In contrast,
IQP Embedding and QAOA Embedding show comparatively
weaker performance in both metrics, especially at lower
layer counts, necessitating more layers to achieve comparable
results. This increases computational demands, making them
less practical for efficient classification tasks. Overall,
amplitude Embedding emerges as the best candidate, offering
an ideal balance of entanglement and expressibility for this
use case.

Figure 10 presents the performance of the classification model across the metrics of accuracy, precision, recall, and F1-score, evaluated on both the Edge IoT and CIC-IDS datasets. The results reveal consistently high metric values across both datasets, suggesting robust classification capabilities. The accuracy chart shows that the model performs reliably, with high scores across both datasets. This indicates its ability to correctly classify both normal and malicious activities. Notably, the accuracy for the Edge IoT dataset is slightly higher, reflecting the model's adaptability to the unique traffic patterns typical of IoT environments. The precision values reveal the model's effectiveness in reducing false positives. For the CIC-IDS dataset, precision is slightly higher, suggesting that the model can differentiate between benign and malicious traffic in complex network conditions, minimizing unnecessary alerts. This is essential for intrusion detection systems to remain efficient and avoid overwhelming administrators. The recall chart highlights the model's strong detection capabilities, particularly for the Edge IoT dataset. This metric demonstrates the model's ability to identify the majority of true intrusions effectively, even in IoT-specific scenarios, where traffic may be noisier or less structured compared to traditional networks. The F1 score provides a balanced view of precision and recall, confirming that the model achieves an effective trade-off between false positives and false negatives. The consistently

high F1 scores across both datasets emphasize the model's
reliability for real-world deployment in varied network
environments. These results reflect the significant impact of
the quantum encoding methods and the VQC architecture
on model performance. The encoding strategies enable the
model to represent and process complex, high-dimensional
network traffic effectively, capturing nuanced patterns indica-
tive of intrusions. Furthermore, the Variational Quantum
Circuit architecture leverages quantum superposition and
entanglement to explore complex decision boundaries that
might be challenging for classical models, particularly in the
IoT domain where resource constraints and heterogeneity are
prevalent.

V. CONCLUSION

In this work, we presented an in-depth comparative analysis
of classical-quantum encoding methods applied to network
intrusion detection. Our results showed that the choice of
encoding plays a decisive role in the performance of quantum
learning models. A crucial part of this study is based on
the reduction of data dimensionality, an essential aspect for
optimizing the use of qubits in quantum circuits. Indeed,
given the current limitations of quantum devices in terms
of the number of qubits available and circuit depth, it is
imperative to find a compromise between the richness of the
encoded data and the accuracy achieved by the models. We
therefore integrated reduction techniques such as XGBoost
and ANOVA to select the most discriminating features,
enabling us to limit the number of qubits required without
significantly compromising accuracy. By experimenting with
different types of encoding (Amplitude Embedding, Angle
Embedding, IQP, QAOA), we sought to balance the accuracy
of the models with the cost of quantum resources. We
also analyzed the impact of dataset granularity, comparing
stream-based (CICIoT2023) and packet-based (EdgeIIoT)
data. Packet-based granular data requires more resources due
to its intrinsic complexity. On the other hand, stream-type
data has shown greater effectiveness in terms of accuracy
<figure><img src="image_12.png" /><figcaption>(a) Amplitude Embedding - Strongly Entangled</figcaption></figure>

<figure><img src="image_13.png" /><figcaption>(b) Amplitude Embedding - Basic Entangled</figcaption></figure>

<figure><img src="image_14.png" /><figcaption>(c) Angle Embedding - Strongly Entangled</figcaption></figure>

<figure><img src="image_15.png" /><figcaption>(d) Angle Embedding - Basic Entangled</figcaption></figure>

<figure><img src="image_16.png" /><figcaption>(e) IQP Embedding - Strongly Entangled</figcaption></figure>

<figure><img src="image_17.png" /><figcaption>(f) IQP Embedding - Basic Entangled</figcaption></figure>

<figure><img src="image_18.png" /><figcaption>(g) QAOA Embedding - Strongly Entangled</figcaption></figure>

<figure><img src="image_19.png" /><figcaption>(h) QAOA Embedding - Basic Entangled</figcaption></figure>

<caption>**FIGURE 10.** Performance Comparison of Quantum Embeddings on Edge IoT and CIC-IDS Datasets. Radar charts illustrate accuracy, precision, F1-score, and recall for each embedding (Amplitude, Angle, IQP, QAOA) under “Strongly” and “Basic” entanglement configurations.</caption>

for targeted DDoS attacks, thanks to its aggregation, which reduces processing complexity. This contrast illustrates the importance of choosing granularity according to available

resources and application context. Our results confirm that the relationship between data granularity, encoding type, and number of qubits used has a strong influence on model
performance. We have demonstrated that this synergy can be optimized to develop high-performance models while effectively minimizing computational costs. These findings pave the way for hybrid classical-quantum approaches, where data granularity and encoding strategies can be dynamically adjusted according to hardware constraints and accuracy requirements. This work highlights the role that quantum computing can bring to intrusion detection, providing parallel processing capabilities and paving the way for more efficient exploration of complex data spaces, pushing back the limits of classical approaches in networked environments. Based on this work, several future extensions are envisaged. First, we propose the exploration and analysis of new quantum learning models, including hybrid and fully quantum approaches, tailored to the field of network intrusion detection. These models could take advantage of the unique strengths of quantum computing to improve detection accuracy and efficiency. Secondly, the design of an integrated framework combining classical and quantum aspects to optimize the intrusion mitigation process represents a promising avenue. This would involve developing a synergistic system in which quantum algorithms enhance specific tasks such as feature selection or anomaly detection, while classical components manage large-scale data processing and mitigation strategies. Thirdly, practical implementations using today's quantum computers should be further investigated, taking into account existing limitations in terms of qubit count and hardware noise. This would involve deploying models on real quantum devices and assessing their feasibility, performance, and potential for extension in real network environments.

REFERENCES

[1] A. M. Alnajim, S. Habib, M. Islam, S. M. Thwin, and F. Alotaibi, "A comprehensive survey of cybersecurity threats, attacks, and effective countermeasures in Industrial Internet of Things," *Technologies*, vol. 11, no. 6, p. 161, 2023, doi: 10.3390/technologies11060161.

[2] N. Kumar and S. Sharma, "Study of intrusion detection system for DDoS attacks in cloud computing," in *Proc. 10th Int. Conf. Wireless Opt. Commun. Netw. (WOCN)*, Bhopal, India, 2013, pp. 1–5, doi: 10.1109/WOCN.2013.6616255.

[3] S. Shen et al., "Deep Q-network-based heuristic intrusion detection against edge-based SIoT zero-day attacks," *Appl. Soft Comput.*, vol. 150, Jan. 2024, Art. no. 111080, doi: 10.1016/j.asoc.2023.111080.

[4] S. Yu et al., "Deep Q-network-based open-set intrusion detection solution for Industrial Internet of Things," *IEEE Internet Things J.*, vol. 11, no. 7, pp. 12536-12550, Apr. 2024, doi: 10.1109/JIOT.2023.3333903.

[5] S. Yu et al., "Novel intrusion detection strategies with optimal hyper parameters for Industrial Internet of Things based on stochastic games and double deep Q-networks," *IEEE Internet Things J.*, vol. 11, no. 17, pp. 29132-29145, May 2024, doi: 10.1109/JIOT.2024.3406386.

[6] M. D. Mauro, G. Galatro, and A. Liotta, "Experimental review of neural-based approaches for network intrusion management," *IEEE Trans. Netw. Service Manag.*, vol. 17, no. 4, pp. 2480-2495, Dec. 2020, doi: 10.1109/TNSM.2020.3024225.

[7] Z. A. El Houda, L. Khoukhi, and A. S. Hafid, "Bringing intelligence to software defined networks: Mitigating DDoS attacks," *IEEE Trans. Netw. Service Manag.*, vol. 17, no. 4, pp. 2523-2535, Dec. 2020, doi: 10.1109/TNSM.2020.3014870.

[8] K. Yang, J. Zhang, Y. Xu, and J. Chao, "DDoS attacks detection with autoencoder," in *Proc. NOMS IEEE/IFIP Netw. Oper. Manag. Symp.*, Budapest, Hungary, 2020, pp. 1-9, doi: 10.1109/NOMS47738.2020.9110372.

[9] K. B. Adedeji, A. M. Abu-Mahfouz, and A. M. Kurien, "DDoS attack and detection methods in internet-enabled networks: Concept, research perspectives, and challenges," *J. Sensor Actuator Netw.*, vol. 12, no. 4, p. 51, 2023, doi: 10.3390/jsan12040051.

[10] J. Li, M. Liu, Z. Xue, X. Fan, and X. He, "RTVD: A real-time volumetric detection scheme for DDoS in the Internet of Things," *IEEE Access*, vol. 8, pp. 36191-36201, 2020, doi: 10.1109/ACCESS.2020.2974293.

[11] V. Gaur and R. Kumar, "Analysis of machine learning classifiers for early detection of DDoS attacks on IoT devices," *Arabian J. Sci. Eng.*, vol. 47, pp. 1353-1374, Feb. 2022, doi: 10.1007/s13369-021-05947-3.

[12] P. Zhang, N. Chen, S. Shen, S. Yu, S. Wu, and N. Kumar, "Future quantum communications and networking: A review and vision," *IEEE Wireless Commun.*, vol. 31, no. 1, pp. 141-148, Feb. 2024, doi: 10.1109/MWC.012.2200295.

[13] G. Carleo et al., "Machine learning and the physical sciences," *Rev. Modern Phys.*, vol. 91, Dec. 2019, Art. no. 45002.

[14] T. M. Khan and A. Robles-Kelly, "Machine learning: Quantum vs classical," *IEEE Access*, vol. 8, pp. 219275-219294, 2020, doi: 10.1109/ACCESS.2020.3041719.

[15] I. Sarker, "Deep learning: A comprehensive overview on techniques, taxonomy, applications and research directions," *SN Comput. Sci.*, vol. 2, p. 420, Aug. 2021, doi: 10.1007/s42979-021-00815-1.

[16] H. Afifi et al., "Machine learning with computer networks: Techniques, Datasets, and Models," *IEEE Access*, vol. 12, pp. 54673-54720, 2024, doi: 10.1109/ACCESS.2024.3384460.

[17] Z. El Houda, A. Hafid, and L. Khoukhi, "A novel machine learning framework for advanced attack detection using SDN," in *Proc. IEEE Global Commun. Conf. (GLOBECOM)*, 2021, pp. 1-6.

[18] Z. A. El Houda, B. Brik, A. Ksentini, and L. Khoukhi, "A MEC-based architecture to secure IoT applications using federated deep learning," *IEEE Internet Things Mag.*, vol. 6, no. 1, pp. 60-63, Mar. 2023.

[19] C. Ciliberto et al., "Quantum machine learning: A classical perspective," *Proc. Roy. Soc. A*, vol. 474, no. 2209, 2018, Art. no. 20170551, doi: 10.1098/rspa.2017.0551.

[20] M. C. Caro et al., "Generalization in quantum machine learning from few training data," *Nat. Commun.*, vol. 13, p. 4919, Aug. 2022, doi: 10.1038/s41467-022-32550-3.

[21] J. Stokes et al., "Quantum natural gradient," *Quantum*, vol. 4, p. 269, May 2020, doi: 10.22331/q-2020-05-25-269.

[22] L. Cheng, Y. Q. Chen, S. X. Zhang, and S. Zhang, "Quantum approximate optimization via learning-based adaptive optimization," *Commun. Phys.*, vol. 7, p. 83, Mar. 2024, doi: 10.1038/s42005-024-01577-x.

[23] M. T. West et al., "Drastic circuit depth reductions with preserved adversarial robustness by approximate encoding for quantum machine learning," *Intell. Comput.*, vol. 3, p. 100, Sep. 2024, doi: 10.34133/ic computing.0100.

[24] M. Monnet, N. Chaabani, T.-A. Dragan, B. Schachtel, and J. M. Lorenz, "Understanding the effects of data encoding on quantum-classical convolutional neural networks," 2024, arXiv:2405.03027.

[25] S. J. Beale, J. J. Wallman, M. Gutiérrez, K. R. Brown, and R. Laflamme, "Quantum error correction decoheres noise," *Phys. Rev. Lett.*, vol. 121, no. 19, 2018, Art. no. 190501, doi: 10.1103/PhysRevLett.121.190501.

[26] L. Banchi, J. Pereira, S. Lloyd, and S. Pirandola, "Convex optimization of programmable quantum computers," 2019, arXiv:1905.01316.

[27] J. Biamonte, P. Wittek, N. Pancotti, P. Rebentrost, N. Wiebe, and S. Lloyd, "Quantum machine learning," *Nature*, vol. 549, pp. 195-202, Sep. 2017, doi: 10.1038/nature23474.

[28] M. Rath and H. Date, "Quantum data encoding: A comparative analysis of classical-to-quantum mapping techniques and their impact on machine learning accuracy," 2023, arXiv:2311.10375.

[29] A. Gouveia and M. Correia, "Towards quantum-enhanced machine learning for network intrusion detection," in *Proc. IEEE 19th Int. Symp. Netw. Comput. Appl. (NCA)*, Cambridge, MA, USA, 2020, pp. 1-8, doi: 10.1109/NCA51143.2020.9306691.

[30] D. Abreu, C. E. Rothenberg, and A. Abelém, "QML-IDS: Quantum machine learning intrusion detection system," 2024, arXiv:2410.16308.

[31] A. Kukliansky, M. Orescanin, C. Bollmann, and T. Huffmire, "Network anomaly detection using quantum neural networks on noisy quantum computers," *IEEE Trans. Quant. Eng.*, vol. 5, no. 1, pp. 1-11, Jan. 2024, doi: 10.1109/TQE.2024.3359574.
[32] A. Tudisco, "Encoding techniques for quantum machine learning," M.S. thesis, Dept. Electron. Eng., Politecnico di Torino, Turin, Italy, 2022. [Online]. Available: http://webthesis.biblio.polito.it/25437

[33] X.-B. Nguyen et al., "Quantum visual feature encoding revisited," *Quant. Mach. Intell.*, vol. 6, no. 2, p. 15, Dec. 2024, doi: 10.1007/s42484-024-00192-x.

[34] A. Alomari and S. A. P. Kumar, "DEQSVC: Dimensionality reduction and encoding technique for quantum support vector classifier approach to detect DDoS attacks," *IEEE Access*, vol. 11, pp. 110570-110581, 2023, doi: 10.1109/ACCESS.2023.3322723.

[35] Y. Y. Hou, J. Li, T. Xu, and X.-Y. Liu, "A hybrid quantum-classical classification model based on branching multi-scale entanglement renormalization ansatz," *Sci. Rep.*, vol. 14, Aug. 2024, Art. no. 18521, doi: 10.1038/s41598-024-69384-6.

[36] M. R. Pulicharla, "Hybrid quantum-classical machine learning models: Powering the future of AI," *J. Sci. Technol.*, vol. 4, no. 1, pp. 40-65, 2023, doi: 10.55662/JST.2023.4102.

[37] E. Payares and J. C. Martinez-Santos, *Quantum Machine Learning for Intrusion Detection of Distributed Denial of Service Attacks: A Comparative Overview*, OPTO, Mantova, Italy, 2021.

[38] T. Chen and C. Guestrin, "XGBoost: A scalable tree boosting system," in *Proc. 22nd ACM SIGKDD Int. Conf. Knowl. Discovery Data Min.*, 2016, pp. 785-794, doi: 10.1145/2939672.2939785.

[39] A. Gelman, "Analysis of variance—Why it is more important than ever," *Ann. Statist.*, vol. 33, no. 1, pp. 1-15, 2005, doi: 10.1214/009053604000001048.

[40] G. Verdon, J. M. Arrazola, K. Brádler, and N. Killoran, "A Quantum Approximate Optimization Algorithm for continuous problems," 2019, arXiv:1902.00409.

[41] M. Schuld, A. Bocharov, K. M. Svore, and N. Wiebe, "Circuit-centric quantum classifiers," *Phys. Rev. A*, vol. 101, no. 3, 2020, Art. no. 32308, doi: 10.1103/PhysRevA.101.032308.

[42] E. C. P. Neto et al., "CICIoT2023: A real-time dataset and benchmark for large-scale attacks in IoT environment," *Sensors*, vol. 23, no. 13, p. 5941, 2023.

[43] M. A. Ferrag et al., "Edge-IIoTset: A new comprehensive realistic cyber security dataset of IoT and IIoT applications for centralized and federated learning," *IEEE Access*, vol. 10, pp. 40281-40306, 2022, doi: 10.1109/ACCESS.2022.3165809.

[44] V. Bergholm et al., "PennyLane: Automatic differentiation of hybrid quantum-classical computations," 2018, arXiv:1811.04968.

[45] E. Stoudenmire and D. Schwab, "Supervised learning with tensor networks," in *Proc. Adv. Neural Inf. Process. Syst.*, 2016, pp. 4806-4814.

[46] M. Schuld and F. Petruccione, *Supervised Learning with Quantum Computers*. Cham, Switzerland: Springer, 2018, doi: 10.1007/978-3-319-96424-9.

[47] V. Havlíček et al., "Supervised learning with quantum-enhanced feature spaces," *Nature*, vol. 567, pp. 209-212, Mar. 2019, doi: 10.1038/s41586-019-0980-2.

[48] S. Lloyd, M. Schuld, A. Ijaz, J. Izaac, and N. Killoran, "Quantum embeddings for machine learning," 2020, arXiv:2001.03622.

[49] S. Sim, P. Johnson, and A. Aspuru-Guzik, "Expressibility and entangling capability of parameterized quantum circuits for hybrid quantum-classical algorithms," *Adv. Quant. Technol.*, vol. 2, Dec. 2019, Art. no. 1900070, doi: 10.1002/qute.201900070.

<figure><img src="image_20.png" /></figure>

**ADAM KADI** received the bachelor's degree in computer science and the master's degree in IT systems security from the University of Caen Normandie, France. He is pursuing a CIFRE (Industrial Agreement for Training through Research) Ph.D. between ENSICAEN, Normandie Université, the GREYC laboratory (CNRS), and the company 6cure, specialized in protection against DDoS and DNS attacks. His thesis focuses on artificial intelligence for DDoS attack mitigation, aiming to develop advanced solutions to address growing cybersecurity challenges.

<figure><img src="image_21.png" /></figure>

**AYMENE SELAMNIA** received the Engineering degree from the Higher School of Computer Networks, Algiers, Algeria, in 2021. He is currently pursuing the Ph.D. degree focusing on the security of Industrial Internet of Things networks with Normandy University, Caen, France. Afterward, he worked as a Research Engineer with Drive Laboratory. His research interests lie in network security and machine learning.

<figure><img src="image_22.png" /></figure>

**ZAKARIA ABOU EL HOUDA** (Member, IEEE) received the First Ph.D. degree in computer science from the University of Montreal, Montreal, QC, Canada, in 2021, and the Second Ph.D. degree in computer engineering from the University of Technology of Troyes, Troyes, France, in 2021. He is currently a Professor with the Energy, Materials, and Telecommunications Center, National Institute of Scientific Research (INRS), Canada. He is also a member of the INRS-UQO Joint Research Unit in Cybersecurity. Prior to joining INRS, he served as a Research Scientist in various institutions, contributing to significant research projects on the application of machine learning for intrusion detection systems, and studying the explainability and robustness of these systems. His current research interests include applied AI for intrusion detection systems, Internet of Things, security in distributed/federated machine learning, quantum machine learning, and Blockchain for network security.

<figure><img src="image_23.png" /></figure>

**HAJAR MOUDOUD** (Member, IEEE) received the B.Eng. degree in software engineering from the Mohammadia School of Engineers, Rabat, Morocco, in 2018, the First Ph.D. degree in computer engineering from the University of Sherbrooke, Canada, in 2022, and the Second Ph.D. degree in computer engineering from the University of Technology of Troyes, France, in 2022. She is currently a Professor with the Département d'information et d'ingénierie, Université du Québec en Outaouais, Canada. Her research interests include the security of the Internet of Things, applied machine/deep learning for intrusion detection systems, and leveraging blockchain to enhance the security of next-generation networks (5G and beyond/6G).

<figure><img src="image_24.png" /></figure>

**BOUZIANE BRIK** (Senior Member, IEEE) received the Engineer degree (Ranked First) in computer science, the M.Sc. and Ph.D. degrees from Laghouat University, Algeria, in 2010, 2013, and 2017, respectively. He is currently working as an Assistant Professor with the Computer Science Department of Computing and Informatics College, Sharjah University, UAE. Before joining Sharjah University, he worked as an Assistant Professor with the DRIVE Department, Bourgogne University, France. He has also worked as a Postdoctoral with the CESI School, University of Troyes, and Eurecom Research Institute, France. He has been working on resources management and security challenges of 5G network slicing in the context of H2020 European projects including MonB5G, 5GDrones, InDiD, and 5G-INSIGHT. His research interests also include 5G and beyond networks, explainable AI, and machine/deep learning for wireless networks. He is an Active Member in many conferences' organizing committees such as Globecom, WCNC, ICC, GIIS, EAI, and EAI CICom. He actively organized different special issues in prestigious journals as well as conference workshops.

<figure><img src="image_25.png" /></figure>

**LYES KHOUKHI** (Senior Member, IEEE) received the Ph.D. degree in electrical and computer engineering from the University of Sherbrooke, Canada, in 2006. From 2007 to 2008, he was a Postdoctoral Researcher with the Department of Computer Science and Operations Research, University of Montreal. He is currently a Full Professor with the ENSICAEN, GREYC CNRS, Normandie University. His current research topics are in the field of cybersecurity, attack detection, and performance evaluation in advanced networks like cloud networking, 5G/SDN, IoT/V2X, and CPS.