[Paper Review] Attack vs Benign Network Intrusion Traffic Classification
This paper demonstrates that a simple k-nearest neighbor (k-NN) classifier achieves near-state-of-the-art performance on the CSE-CIC-IDS2018 dataset for intrusion detection, matching or exceeding complex deep learning models in accuracy, F-measure, and recall—especially on imbalanced data—without requiring model training, hyperparameter tuning, or risk of overfitting.
Intrusion detection systems (IDS) are used to monitor networks or systems for attack activity or policy violations. Such a system should be able to successfully identify anomalous deviations from normal traffic behavior. Here we discuss the machine learning approach to building an anomaly-based IDS using the CSE-CIC-IDS2018 dataset. Since the publication of this dataset a relatively large number of papers have been published, most of them presenting IDS architectures and results based on complex machine learning methods, like deep neural networks, gradient boosting classifiers, or hidden Markov models. Here we show that similar results can be obtained using a very simple nearest neighbor classification approach, avoiding the inherent complications of training such complex models. The advantages of the nearest neighbor algorithm are: (1) it is very simple to implement; (2) it is extremely robust; (3) it has no parameters, and therefore it cannot overfit the data. This result also shows that currently there is a trend of developing over-engineered solutions in the machine learning community. Such solutions are based on complex methods, like deep learning neural networks, without even considering baseline solutions corresponding to simple, but efficient methods.
Motivation & Objective
- To evaluate whether simple, non-parametric machine learning methods can match the performance of complex deep learning models in intrusion detection using the CSE-CIC-IDS2018 dataset.
- To challenge the prevailing trend of over-engineering in machine learning by demonstrating that baseline methods like k-NN can be sufficient and more robust.
- To highlight the risks of overfitting and excessive computational cost associated with deep learning models in network intrusion detection.
- To provide a minimal, parameter-free alternative to complex models that avoids training and hyperparameter tuning.
- To show that the nearest neighbor approach maintains strong performance even on highly imbalanced data, such as the 03-01-2018.csv file, where deep learning models underperform.
Proposed method
- The study employs a k-nearest neighbor (k-NN) classification approach using dot product similarity to compute the nearest training sample for each test instance.
- For each test sample, the algorithm computes the dot product between the test vector and all training vectors, selecting the training sample with the highest similarity as the predicted class.
- The method uses 5-fold cross-validation, splitting each data file into five equal parts, training on 80% and testing on 20% in each fold, then averaging performance metrics.
- Data normalization is applied to ensure feature scale consistency before classification, with timestamp and missing-value columns removed.
- Performance is evaluated using standard metrics: accuracy, precision, recall, and F-measure, averaged across all 5-fold iterations.
- The approach requires no model training, no hyperparameter tuning, and no risk of overfitting due to the absence of learnable parameters.
Experimental results
Research questions
- RQ1Can a simple, non-parametric nearest neighbor classifier achieve performance comparable to complex deep learning models on the CSE-CIC-IDS2018 intrusion detection dataset?
- RQ2Does the absence of model training and hyperparameter tuning in k-NN lead to better generalization and robustness compared to deep learning methods?
- RQ3How does k-NN perform on highly imbalanced data, such as the 03-01-2018.csv file, where benign and attack traffic patterns are highly similar?
- RQ4Why do deep learning models report high accuracy but poor F-measure and recall on certain data files, and does k-NN mitigate this issue?
- RQ5To what extent is the current trend toward complex deep learning models in intrusion detection justified, given the strong performance of simpler alternatives?
Key findings
- The k-NN classifier achieved an overall accuracy of 98.58% and F-measure of 96.67% across all data files, demonstrating strong generalization on the CSE-CIC-IDS2018 dataset.
- On most data files, including 02-14-2018.csv and 03-02-2018.csv, k-NN achieved near-perfect accuracy (0.9999) and F-measure (0.9999), outperforming deep learning models in F-measure and recall.
- On the 03-01-2018.csv file—where deep learning models reported poor F-measure (0.34–0.49)—k-NN achieved a recall of 0.4227 and F-measure of 0.4564, significantly outperforming the best deep learning model (F-measure 0.4852) in this challenging case.
- The k-NN method achieved a 100% recall on 02-14-2018.csv and 02-16-2018.csv, indicating effective detection of all attack instances in those files.
- The k-NN approach required no training time or hyperparameter tuning, unlike deep learning models that required over 13.5 days of training, highlighting its computational efficiency.
- The results suggest that deep learning models may be overfitting to the 03-01-2018.csv data, as their F-measure and recall are substantially lower than k-NN’s, despite higher reported accuracy.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.