Unsupervised Network Anomaly Detection with Autoencoders and Traffic Images

Michael Neri 1 , Sara Baldoni 2 · 2025

Read Unsupervised Network Anomaly Detection with Autoencoders and Traffic Images by Michael Neri 1 , Sara Baldoni 2 (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2505-16650.txt.

Introduction

Neri and Baldoni turn network traffic into images to spot intrusions without labels in a 2025 paper. Connected devices keep multiplying, and traffic volume is huge. Device types vary widely in computing power.

Their method pictures one second of traffic as a compact image. Anomalies stand out visually in these pictures, which lightens later processing. An autoencoder learns normal patterns and flags departures from them. The approach is unsupervised, so it needs no labeled attack data. The authors share their code and dataset openly. The design suits security monitoring on mixed networks of weak devices. It aims for prompt detection of security issues.

Catalog record

CREATORMichael Neri 1 , Sara Baldoni 2
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE25 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2505-16650

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Unsupervised Network Anomaly Detection with Autoencoders and Traffic Images Thanks: The research presented in this paper was partially funded by the project “ISEEYOO: AI-based Network Anomaly Detection for CPS exploiting 2D data representation” within the University of Padova funding framework “SEED research grants.” Michael Neri 1 , Sara Baldoni 2 Abstract Due to the recent increase in the number of connected devices, the need to promptly detect security issues is emerging. Moreover, the high number of communication flows creates the necessity of processing huge amounts of data. Furthermore, the connected devices are heterogeneous in nature, having different computational capacities. For this reason, in this work we propose an image-based representation of network traffic which allows to realize a compact summary of the current network conditions with 1-second time windows. The proposed representation highlights the presence of anomalies thus reducing the need for complex processing architectures. Finally, we present an unsupervised learning approach which effectively detects the presence of anomalies. The code and the dataset are available at https://github.com/michaelneri/image-based-network-traffic-anomaly-detection . AE Autoencoder AI Artificial Intelligence BCE Binary Cross-Entropy CNN Convolutional Neural Network CPS Cyber-Physical System DDoS Distributed Denial-of-Service DoS Denial-of-Service ELBO Evidence Lower Bound ELU Exponential Linear Unit FCN Fully Convolutional Network GAN Generative Adversarial Network GNN Graph Neural Network ICA Independent Component Analysis IDS Intrusion Detection System IoT Internet of Things IR Information Retrieval LR Logistic Regression LSTM Long Short-Term Memory GMAC Giga Multiply-Accumulate Operation MSA Multivariate Statistical Analysis RF Random Forest RNN Recurrent Neural Network SVM Support Vector Machines PCA Principal Component Analysis PFA Probability of False Alarm VAE Variational Autoencoder I Introduction The current diffusion of Internet-related technologies is leading to an unprecedented connectivity among heterogeneous devices with varied computational capabilities. The extensive use of computer networks creates security risks that can lead to misconduct and substantial harm. These threats are dynamic and prone to evolve into unknown forms [ 1 ] . To properly react to this danger, a prompt detection of anomalous network behaviors is needed. An anomalous event can be defined as a network pattern that diverges from the expected normal behavior [ 2 ] . The design of anomaly detection techniques is challenging for several reasons. First, the wide diffusion of connected devices causes a relevant increase in the number of traffic flows, making the real-time detection of anomalies a demanding task. Moreover, due to the inherent disparity between the amount of normal and anomalous data flows, the adoption of supervised learning methods is hindered. Furthermore, these techniques often fail in accurately identifying unfamiliar abnormal behaviors [ 3 , 4 ] . Consequently, the exploration of unsupervised learning techniques has emerged as a prominent direction for addressing anomaly detection within telecommunication networks. In the context of unsupervised techniques, a key task consists in modeling the normal state of a telecommunication network. To this end, different types of predictors such as traffic usage, protocols, and number of flows can be employed [ 4 , 5 ] . Due to the high number of predictors, dimensionality reduction techniques, such as PCA ( PCA ) [ 6 ] , have been employed for analyzing network traffic [ 7 , 8 , 9 ] . (a) Normal (b) DoS (c) Scan Fig. 1: Examples of \mathcal{I} for normal and anomalous traffic. The light-blue square indicates the pixels corresponding to anomalous traffic patterns. The matrices are obtained for 1-second time windows from the dataset presented in [ 10 ] . Recently, deep learning in anomaly detection has represented an important shift from traditional PCA -based methods. Deep learning approaches can capture non-linear relationships and high-level abstractions, offering enhanced detection capabilities in diverse and complex scenarios [ 11 ] . However, AE ( AE )-based anomaly detectors trained on normal traffic data are prone to generalization problems [ 11 ] . In fact, even unseen abnormal patterns can be correctly retrieved by reconstruction-based approaches. To mitigate this problem, One-Class SVM ( SVM ), VAE ( VAE ), and GAN ( GAN ) have been proposed in literature [ 12 , 13 , 14 , 15 ] . Instead of realizing a complex learning-based detector, we propose to address the network anomaly detection issue from a different perspective. One of the limitations of the existing methods is that they directly process network flows and traffic features without performing a pre-processing step for highlighting hidden traffic peculiarities. This work, on the contrary, proposes an image-based representation of network traffic. The proper definition of the image representation provides a compact picture of the current condition of the monitored network, reducing the complexity of the learning architecture. This direction has been partially investigated in [ 16 ] , where a 2D representation of network activity for CPS has been devised. However, the defined 2D representation is sparse thus failing in simplifying the processing pipeline. Indeed, in [ 17 ] a complex VAE has been implemented for detecting anomalies from the representation proposed in [ 16 ] using reconstruction-based errors for the detection. In this work, we leverage the representation used in [ 16 , 17 ] reducing the image sparsity and making the network patterns more evident. This allows to reduce the complexity of the learning architecture. To demonstrate this assertion, we test two reconstruction-based anomaly detectors: a lightweight VAE and a vanilla AE . The contributions of this work can be summarized as follows: i) a new image-based representation of network traffic that highlights the presence of attacks, thus requiring a low-complexity anomaly detector; ii) the quantitative comparison between different types of 2D representations; iii) the comparison between anomaly detectors with different complexities. (a) Normal, \mathcal{I} (b) Anomaly, \mathcal{I} (c) Normal, \mathcal{I_{C}} (d) Anomaly, \mathcal{I_{C}} Fig. 2: Examples of \mathcal{I} and \mathcal{I}_{C} for normal and anomalous traffic in a limit case scenario. (a) Normal (b) DoS (c) Scan Fig. 3: Examples of \mathcal{I}_{C} for normal and anomalous traffic. The matrices are obtained for 1-second time windows from the dataset presented in [ 10 ] . II Anomaly detection method In this section an anomaly detector which exploits an image-based traffic representation is described. In more detail, a 2D matrix containing network traffic information has been defined and an AE has been designed and trained to reconstruct normal traffic images in an unsupervised fashion. By doing so, anomalous traffic representations are poorly retrieved by the AE , yielding high reconstruction errors. This property makes the AE suitable for anomaly detection scenarios where labeled anomalous instances may be scarce or unavailable. In fact, the model learns to generalize from the normal data without explicitly receiving information about anomalies. This capability represents the reason for which we opted for an AE -based strategy. II-A Network traffic representation The image-based representation proposed in [ 16 ] associates every pixel to a source-destination IP pair, (i,j) , and computes every pixel value, p(i,j) , as p(i,j)=\frac{\Sigma(i,j)-\mu(i,j)}{\sigma(i,j)+10^{-4}}\times e^{f(i,j)}, (1) where \Sigma(i,j) is the amount of bytes exchanged between i and j in a time window, \mu(i,j) and \sigma(i,j) are the corresponding mean and standard deviation, and f(i,j) is the number of flows. Although this representation effectively highlights the presence of an attack, it is not suitable for being processed through deep learning algorithms due to the high signal dynamics

Read the complete text