# Where to Sample: Rethinking ML-Based Malicious Traffic Detection at Terabit Scale

DevFeed: [Where to Sample: Rethinking ML-Based Malicious Traffic Detection at Terabit Scale](<https://devfeed.tech/articles/where-to-sample-rethinking-ml-based-malicious-traffic-detection-at-terabit-scale-104182.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2403.18788>)

Author: Jo\\~ao Romeiras Amado, Francisco Pereira, David Pissarra, Salvatore Signorello, Miguel Correia, Fernando M. V. Ramos

Published: 2026-10-28T04:00:00Z

Content type: news

Language: en

Sources: [arXiv: Networking](<https://devfeed.tech/sources/arxiv-networking.md>)

Topics: [Machine learning](<https://devfeed.tech/topics/machine-learning.md>), [network-intelligence](<https://devfeed.tech/topics/network-intelligence.md>), [Internet Traffic](<https://devfeed.tech/topics/internet-traffic.md>), [Threat Research](<https://devfeed.tech/topics/threat-research.md>)

Tags: [cs-ni](<https://devfeed.tech/tags/cs-ni.md>), [detection](<https://devfeed.tech/tags/detection.md>), [features](<https://devfeed.tech/tags/features.md>), [machine-learning](<https://devfeed.tech/tags/machine-learning.md>), [malicious](<https://devfeed.tech/tags/malicious.md>), [sampling](<https://devfeed.tech/tags/sampling.md>), [scale](<https://devfeed.tech/tags/scale.md>), [traffic](<https://devfeed.tech/tags/traffic.md>)

## AI overview

Peregrine addresses the limits of packet sampling in ML-based malicious-traffic detection by computing features over all traffic at line rate in a programmable switch, then sampling the feature records sent to software inference. Across 84 attack traces from three datasets, its evaluation found that approximate features computed from all packets can outperform exact features computed from sampled packets. Peregrine preserved detection effectiveness while reducing feature-record rates by three orders of magnitude, including cases where sampling packets before feature computation caused detection to collapse. The architecture was instantiated with two detectors that have different feature-computation requirements.

## Source excerpt

arXiv:2403.18788v2 Announce Type: replace Abstract: Machine Learning (ML)-based malicious traffic detectors can identify unseen attacks, including in encrypted traffic, but scaling them to Terabit rates remains challenging. Packet sampling, commonly used to meet processing limits, can discard essential behavioral information and render detection ineffective. We present Peregrine, a hardware-software co-designed architecture built around a simple principle: compute features before sampling. Peregrine updates ML features over all traffic at line rate in a programmable switch, then downsamples the feature records sent to software inference. We instantiate this design with two detectors that impose distinct feature-computation requirements on the switch. Across 84 attack traces from three datasets, we show that approximate features computed over all packets can outperform exact features computed from sampled packets. In our evaluation, Peregrine preserves detection effectiveness while reducing feature-record rates by three orders of magnitude - even where pre-feature sampling causes detection to collapse.