Research gapComputer science

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.

PhD Research Lab InsightsEditorial team, reviewed by a subject specialist
Posted
7 September 2022
Last checked
8 October 2026
Reading time
7 min
Sources
13
Research proposal support
The gap

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).
  • Public intrusion datasets are generated in testbeds and differ in traffic, features and attack types (Ring et al., 2019; Sharafaldin et al., 2018; Koroniotis et al., 2019).
  • 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).
  • Federated and on-device learning are being explored for IoT intrusion detection (Rahman et al., 2020; Agrawal et al., 2022).

What we do not know yet

Research questions a PhD could ask

  1. How much does detection performance fall when a model trained on one public dataset is tested on another, with a harmonised feature set?
  2. Does a time-aware train and test split reduce reported performance compared with a random split on the same data?
  3. What false-alarm rate per day would a detector produce at realistic attack base rates in a campus or enterprise network?
  4. Which realistic adversarial changes to traffic, within the attacker's actual capabilities, evade current detectors?
Methods that could close the gap
ApproachWhy it fits
Cross-dataset evaluationTrain on one dataset and test on others with harmonised features (Booij et al., 2022; Ring et al., 2019).
Time-aware splitsTest on traffic later than the training data to expose drift (Pendlebury et al., 2019).
Pitfall auditCheck a pipeline against known pitfalls and leakage (Arp et al., 2022; Kapoor & Narayanan, 2023).
Realistic adversarial testingModel attackers with realistic access and goals (Apruzzese et al., 2023; Vassilev et al., 2025).
Federated and on-device experimentsCompare architectures on constrained IoT hardware (Rahman et al., 2020; Agrawal et al., 2022).
Gap typeHeavily researched, still unsolved

The problem

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).

Why it happens

Datasets are lab-generated and age quickly (Ring et al., 2019; Sharafaldin et al., 2018); evaluation designs leak information between training and test sets (Kapoor & Narayanan, 2023; Arp et al., 2022); and attackers adapt (Apruzzese et al., 2023).

Where it is felt most

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

What studies say, and at what level of evidence
LevelWhat it shows
Surveys and systematic studiesAlgorithm surveys describe many models (Ahmad et al., 2021); dataset surveys describe the data they are tested on (Ring et al., 2019).
Methodological auditsPitfalls and leakage are common in security and other ML research (Arp et al., 2022; Kapoor & Narayanan, 2023; Pendlebury et al., 2019).
Dataset papersCICIDS2017, Bot-IoT and ToN_IoT were built in testbeds (Sharafaldin et al., 2018; Koroniotis et al., 2019; Booij et al., 2022).
Adversarial ML literatureTaxonomies of attacks and evidence on what real attackers do (Vassilev et al., 2025; Apruzzese et al., 2023).
What is missingEvaluations on operational traffic, cross-dataset and time-aware tests, and realistic false-alarm costs.

Who should take this on

Scholar profile

  • A computer scientist with access to a campus, enterprise or ISP network willing to share traffic.
  • A machine-learning researcher interested in distribution shift and robust evaluation.
  • A security practitioner who can judge alert quality and operational cost.

Subjects and PhD specialisations

  • Computer science (cybersecurity, machine learning)
  • Network engineering
  • Information security
  • Electrical and electronic engineering (IoT and industrial systems)

Countries where the problem is greatest

  • Countries with national cyber security research programmes and data-sharing schemes, where operational data may be available.
  • Settings deploying large IoT and industrial networks, where constrained detectors are needed (Rahman et al., 2020; Booij et al., 2022).

Scope for future research

  1. Cross-network and cross-time generalisation of detectors (Pendlebury et al., 2019).
  2. Realistic datasets and labelling of operational traffic (Ring et al., 2019).
  3. Detection under realistic adversarial adaptation (Apruzzese et al., 2023).
  4. Evaluation that reports base rates and false-alarm costs (Arp et al., 2022).
  5. Federated and lightweight detection for IoT (Agrawal et al., 2022).

How a doctoral project could address it

  1. State the threat model

    Define the attacker and the network you protect (Vassilev et al., 2025).

  2. Choose data deliberately

    Use at least two datasets and justify each (Ring et al., 2019).

  3. Split by time and source

    Avoid random splits that leak information (Pendlebury et al., 2019; Kapoor & Narayanan, 2023).

  4. Audit for pitfalls

    Check your pipeline against the known list (Arp et al., 2022).

  5. Report operational metrics

    Give false alarms per day at realistic base rates, not only accuracy.

  6. 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
MistakeWhy it misleadsBetter practice
Random train and test split on one datasetNear-duplicate flows leak across the splitSplit by time or capture session (Pendlebury et al., 2019)
Reporting accuracy onlyAttacks are rare in real traffic, so accuracy hides false alarmsReport precision, recall and false alarms at realistic base rates (Arp et al., 2022)
Testing on one datasetDatasets differ in features and labelsCross-dataset tests with harmonised features (Booij et al., 2022)
Ignoring the attackerReal attackers adaptState a threat model (Vassilev et al., 2025; Apruzzese et al., 2023)

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 to do now

  • Read Sommer and Paxson (2010) and Arp et al. (2022) before choosing a model.
  • Pick two datasets and plan a time-aware split.
  • Write a threat model and the operational metrics you will report.
  • Agree data access and ethics arrangements with your supervisor.
Your next step

Could this gap become your thesis?

  1. 1Read the evidence and the open questions
  2. 2Talk to a mentor about fit, data and method
  3. 3Build a defensible proposal
See proposal support

Questions scholars ask

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

  1. 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
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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]}
}

  • Intrusion detection
  • Machine learning
  • Cybersecurity
  • Network security
  • Evaluation methods
Machine-learning intrusion detection: why lab accuracy does not survive real networksResearch gap · Computer science
Proposal support