Machine-learning intrusion detection: why lab accuracy does not survive real networks
Papers on machine-learning intrusion detection often report very high accuracy on public datasets, yet such systems are rarely trusted in operation. A review of 30 security papers found lab-only evaluation in 14 of them (Arp et al., 2022), and the gap between benchmark and network is the main open problem.
PRPhD Research Lab InsightsEditorial team, reviewed by a subject specialist
Most machine-learning network intrusion detection systems are trained and tested on a few lab-generated datasets with random splits. We do not know how well they detect attacks in other networks, over time, at realistic base rates and against attackers who adapt (Sommer & Paxson, 2010; Arp et al., 2022; Ring et al., 2019).
Evaluation gap (lab versus operation)Data gap (realistic, current, labelled traffic)Robustness gap (drift and adaptive attackers)Deployment gap (constrained and distributed devices)
What we know
Anomaly detection in networks is harder than in many other machine-learning domains because of high error costs, a semantic gap between alerts and actions, and scarce realistic training data (Sommer & Paxson, 2010).
Reviewing 30 papers from the top four security venues, Arp et al. (2022) identified ten pitfalls, including sampling bias, data snooping (in 17 papers) and lab-only evaluation (in 14).
Even within IoT intrusion data, heterogeneity of features and attack labels makes results hard to compare (Booij et al., 2022).
Experimental bias from time and class distribution inflates malware classifiers, a problem that applies to detection generally (Pendlebury et al., 2019).
High benchmark scores for machine-learning intrusion detectors do not show that they will work in a real network, so security teams cannot rely on them and research progress is hard to judge (Sommer & Paxson, 2010; Arp et al., 2022).
The gap matters most for enterprise and data-centre networks and for IoT and industrial networks, where devices are constrained and traffic is diverse (Koroniotis et al., 2019; Booij et al., 2022).
How big is the problem
30papers from the top four security venues reviewed for machine-learning pitfalls (Arp et al., 2022).
17 of 30of those papers showed data snooping (Arp et al., 2022).
Give false alarms per day at realistic base rates, not only accuracy.
Handle data ethically
Agree network data access, anonymisation and ethics approval.
Why it is worth solving
Security teams would gain detectors whose performance they can predict, and fewer false alarms to chase (Sommer & Paxson, 2010).
For science, honest evaluation would separate real advances from artefacts of datasets and splits, which audits show are common (Arp et al., 2022; Kapoor & Narayanan, 2023).
From algorithms to evaluation
A 2021 survey (Ahmad et al., 2021) covered decision trees, nearest neighbours, support vector machines, neural networks and ensembles, with challenges such as dataset quality, class imbalance and resource demands. Those algorithms are well studied. What remains unsolved is whether any of them work outside the dataset they were tuned on.
The warning is old. Sommer and Paxson (2010) explained why anomaly detection in networks is harder than other machine-learning tasks. More recent audits show that the same mistakes persist: data snooping, biased sampling and lab-only evaluation are common in leading venues (Arp et al., 2022), and data leakage affects machine-learning research far beyond security (Kapoor & Narayanan, 2023).
Common mistakes and what to do instead
Evaluation pitfalls in machine-learning intrusion detection
Worked example (illustrative): a researcher trains a gradient-boosting detector on CICIDS2017 (Sharafaldin et al., 2018) and gets very high scores with a random split. Re-testing with a split by day, then on ToN_IoT with harmonised features (Booij et al., 2022), shows how much of the score came from the split and the dataset. Reporting all three results is itself a contribution.
What is the difference between misuse and anomaly detection?
Misuse (signature) detection looks for known attack patterns; anomaly detection learns normal behaviour and flags departures from it. Anomaly detection can find new attacks but tends to raise more false alarms (Sommer & Paxson, 2010).
Is CICIDS2017 still a good dataset?
It is widely used, but it was generated in a testbed (Sharafaldin et al., 2018); use it alongside other data and say why.
Do I need deep learning?
Not necessarily. The main gap is evaluation, not model complexity (Arp et al., 2022).
Sources
Agrawal, S., Sarkar, S., Aouedi, O., Yenduri, G., Piamrat, K., Alazab, M., Bhattacharya, S., Maddikunta, P. K. R., & Gadekallu, T. R. (2022). Federated learning for intrusion detection system: Concepts, challenges and future directions. Computer Communications, 195, 346–361. https://doi.org/10.1016/j.comcom.2022.09.012
Ahmad, Z., Shahid Khan, A., Wai Shiang, C., Abdullah, J., & Ahmad, F. (2021). Network intrusion detection system: A systematic study of machine learning and deep learning approaches. Transactions on Emerging Telecommunications Technologies, 32(1), e4150. https://doi.org/10.1002/ett.4150
Apruzzese, G., Anderson, H. S., Dambra, S., Freeman, D., Pierazzi, F., & Roundy, K. (2023). "Real attackers don't compute gradients": Bridging the gap between adversarial ML research and practice. In 2023 IEEE Conference on Secure and Trustworthy Machine Learning (SaTML) (pp. 339–364). IEEE. https://doi.org/10.1109/SaTML54575.2023.00031
Arp, D., Quiring, E., Pendlebury, F., Warnecke, A., Pierazzi, F., Wressnegger, C., Cavallaro, L., & Rieck, K. (2022). Dos and don'ts of machine learning in computer security. In Proceedings of the 31st USENIX Security Symposium (pp. 3971–3988). USENIX Association. https://www.usenix.org/conference/usenixsecurity22/presentation/arp
Booij, T. M., Chiscop, I., Meeuwissen, E., Moustafa, N., & den Hartog, F. T. H. (2022). ToN_IoT: The role of heterogeneity and the need for standardization of features and attack types in IoT network intrusion data sets. IEEE Internet of Things Journal, 9(1), 485–496. https://doi.org/10.1109/JIOT.2021.3085194
Kapoor, S., & Narayanan, A. (2023). Leakage and the reproducibility crisis in machine-learning-based science. Patterns, 4(9), 100804. https://doi.org/10.1016/j.patter.2023.100804
Koroniotis, N., Moustafa, N., Sitnikova, E., & Turnbull, B. (2019). Towards the development of realistic botnet dataset in the Internet of Things for network forensic analytics: Bot-IoT dataset. Future Generation Computer Systems, 100, 779–796. https://doi.org/10.1016/j.future.2019.05.041
Pendlebury, F., Pierazzi, F., Jordaney, R., Kinder, J., & Cavallaro, L. (2019). TESSERACT: Eliminating experimental bias in malware classification across space and time. In Proceedings of the 28th USENIX Security Symposium (pp. 729–746). USENIX Association. https://www.usenix.org/conference/usenixsecurity19/presentation/pendlebury
Rahman, S. A., Tout, H., Talhi, C., & Mourad, A. (2020). Internet of things intrusion detection: Centralized, on-device, or federated learning? IEEE Network, 34(6), 310–317. https://doi.org/10.1109/MNET.011.2000286
Ring, M., Wunderlich, S., Scheuring, D., Landes, D., & Hotho, A. (2019). A survey of network-based intrusion detection data sets. Computers & Security, 86, 147–167. https://doi.org/10.1016/j.cose.2019.06.005
Sharafaldin, I., Lashkari, A. H., & Ghorbani, A. A. (2018). Toward generating a new intrusion detection dataset and intrusion traffic characterization. In Proceedings of the 4th International Conference on Information Systems Security and Privacy (ICISSP 2018) (pp. 108–116). SciTePress. https://doi.org/10.5220/0006639801080116
Sommer, R., & Paxson, V. (2010). Outside the closed world: On using machine learning for network intrusion detection. In 2010 IEEE Symposium on Security and Privacy (pp. 305–316). IEEE. https://www.icsi.berkeley.edu/icsi/publication_details?n=2818
Vassilev, A., Oprea, A., Hamin, M., Fordyce, A., Anderson, H., & Davies, X. (2025). Adversarial machine learning: A taxonomy and terminology of attacks and mitigations (NIST AI 100-2e2025). National Institute of Standards and Technology. https://doi.org/10.6028/NIST.AI.100-2e2025
How to cite this page
Choose your referencing style, then copy.
PhD Research Lab Insights. (2022, September 7). Machine-learning intrusion detection: why lab accuracy does not survive real networks. PhD Research Lab. https://www.phdassistance.com/blog/systematic-investigation-of-machine-learning-techniques-for-network-intrusion-detection/
PhD Research Lab Insights. “Machine-learning Intrusion Detection: Why Lab Accuracy Does Not Survive Real Networks.” PhD Research Lab, 7 Sept. 2022, www.phdassistance.com/blog/systematic-investigation-of-machine-learning-techniques-for-network-intrusion-detection. Accessed [access date].
PhD Research Lab Insights (2022) Machine-learning intrusion detection: why lab accuracy does not survive real networks. PhD Research Lab. Available at: https://www.phdassistance.com/blog/systematic-investigation-of-machine-learning-techniques-for-network-intrusion-detection/ (Accessed: [access date]).
PhD Research Lab Insights. “Machine-learning Intrusion Detection: Why Lab Accuracy Does Not Survive Real Networks.” PhD Research Lab. September 7, 2022. https://www.phdassistance.com/blog/systematic-investigation-of-machine-learning-techniques-for-network-intrusion-detection.
PhD Research Lab Insights, ‘Machine-learning Intrusion Detection: Why Lab Accuracy Does Not Survive Real Networks’ (PhD Research Lab, 7 September 2022) <https://www.phdassistance.com/blog/systematic-investigation-of-machine-learning-techniques-for-network-intrusion-detection> accessed [access date].
PhD Research Lab Insights. Machine-learning intrusion detection: why lab accuracy does not survive real networks [Internet]. PhD Research Lab; 2022 Sep 7 [cited [access date]]. Available from: https://www.phdassistance.com/blog/systematic-investigation-of-machine-learning-techniques-for-network-intrusion-detection/
PhD Research Lab Insights, “Machine-learning intrusion detection: why lab accuracy does not survive real networks,” PhD Research Lab, Sept. 7, 2022. [Online]. Available: https://www.phdassistance.com/blog/systematic-investigation-of-machine-learning-techniques-for-network-intrusion-detection. [Accessed: [access date]].
@online{systematic_investigation_of_machine_learning_techniques_for_network_intrusion_detection_2022, author = {{PhD Research Lab Insights}}, title = {{Machine-learning intrusion detection: why lab accuracy does not survive real networks}}, organization = {PhD Research Lab}, date = {2022-09-07}, url = {https://www.phdassistance.com/blog/systematic-investigation-of-machine-learning-techniques-for-network-intrusion-detection}, urldate = {[access date]} }