## 2 Materials and Methods
### Ae  
AEs are unsupervised neural network architectures introduced by [PERSON], [PERSON], and [PERSON] in the 1980s, and later popularized in DL by [PERSON] and [PERSON] in 2006. Their primary objective is to learn compact, informative representations of input data by reconstructing the input through a bottleneck architecture. The AE consists of two major components: an encoder that maps input data into a lower-dimensional latent space, and a decoder that reconstructs the input from the latent representation [40]. This compression-reconstruction mechanism enables the model to capture essential structure in the data, making AEs valuable for feature learning, dimensionality reduction, and anomaly detection. One of the key advantages of AEs is their ability to model data distributions without requiring labeled examples. This makes them highly applicable to scenarios such as intrusion detection in edge and IIoT systems, where labeled attack data are limited and often noisy. Furthermore, the reconstruction error between the input and the output can serve as a strong indicator of anomalous behavior--data points that significantly deviate from the learned distribution typically yield high reconstruction error. This capability allows AEs to operate effectively in highly imbalanced environments by learning compact representations of normal patterns and flagging deviations [43].  
The architecture of a standard AE is shown in Figure 2, where real data samples (either directly from the dataset or generated by a trained GAN) are fed into an encoder-decoder pair. The encoder compresses the input into a latent feature space, and the decoder attempts to reconstruct the original input from this compressed representation. The training process involves minimizing the reconstruction loss between the input and output data. As illustrated, the encoder and decoder are composed of fully connected layers, and the overall objective is to learn a smooth, low-dimensional manifold of the input space that preserves the critical structural information [44].  
The fundamental objective of training an \(AE\) is to minimize the difference between the input data and its reconstruction. This can be expressed by the reconstruction loss function shown in Equation (4):  
\[L_{AE}=\frac{1}{N}\sum_{i=1}^{N}\lVert x_{i}-\hat{x}_{i}\rVert^{2} \tag{4}\]  
Figure 2: The architecture of standard AE.  
where \(N\) is the total number of input samples; \(x_{i}\) is the \(i\)-th input data sample; \(\hat{x}_{i}\) is the reconstruction of \(x_{i}\) produced by the \(AE\); \(L_{AE}\) is the mean squared reconstruction loss over all samples; and \(\left\|.\right\|^{2}\) is the squared Euclidean norm. This reconstruction loss is minimized during training via backpropagation, allowing the encoder to learn efficient representations of the input data while the decoder learns to invert this transformation. In the context of our work, incorporating the \(AE\) after the GAN-generated or real input serves a dual purpose: it reduces the impact of noise and improves robustness by regularizing the input space before classification or further analysis. This denoising and reconstruction capacity of AEs makes them a powerful module within our proposed Transformer-GAN-AE hybrid framework [43].