Manuscript Offprint
arXiv:2609.07156Frequency-Domain Mixing Data Augmentation for Malicious Traffic Detection
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Yuhao Yan
State Key Laboratory of Complex & Critical Software Environment,
Beihang University
Beijing, China
Bo Lang
State Key Laboratory of Complex & Critical Software Environment,
Beihang University
Beijing, China
Xiangyu Li
State Key Laboratory of Complex & Critical Software Environment,
Beihang University
Beijing, China
Abstract
The strong dynamics of network traffic often force malicious traffic detection models to handle out-of-distribution data. Typically, deep learning-based malicious traffic detection models require a large amount of high-quality training data. However, owing to challenges such as high labeling difficulty and resource consumption, existing datasets often suffer from insufficient diversity and fail to capture evolving traffic patterns, leading to poor out-of-distribution generalization ability of the trained models. Data augmentation has been widely adopted to improve data diversity and model generalization. Recently, frequency-domain mixing augmentation has shown promising performance because it effectively perturbs data while preserving key structural information. This approach shows potential for enhancing malicious traffic detection models. However, existing studies lack theoretical interpretation of the mixing mechanism, and do not adapt to the characteristics of network traffic. In this paper, we first conduct a theoretical analysis of the current frequency-domain mixing method, revealing its underlying principles and limitations. We further propose an improved frequency-domain mixing-based data augmentation method for network traffic data, which enhances the diversity of sequence features in network traffic and improves the out-of-distribution generalization of malicious traffic detection models. Extensive experiments on multiple artificial and real-world datasets demonstrate that our method substantially improves detection performance across diverse network environments and outperforms other data augmentation approaches.
CCS Concepts
• Security and privacy → Intrusion detection systems.
ACM Reference Format:
Yuhao Yan, Bo Lang, and Xiangyu Li. 2026. Frequency-Domain Mixing Data Augmentation for Malicious Traffic Detection. In Proceedings of the 2026
Corresponding author.

This work is licensed under a Creative Commons Attribution 4.0 International License. CCS '26, The Hague, Netherlands.
© 2026 Copyright held by the owner/author(s).
ACM ISBN 979-8-4007-2871-6/2026/11
https://doi.org/10.1145/3830454.3846642
ACM SIGSAC Conference on Computer and Communications Security (CCS '26), November 15–19, 2026, The Hague, Netherlands. ACM, New York, NY, USA, 19 pages. https://doi.org/10.1145/3830454.3846642
1 Introduction
Malicious network traffic detection is highly important for network security. Deep learning techniques are now widely used in malicious traffic detection [10, 11, 16, 17, 22–24, 37] and have demonstrated excellent performance. Compared with traditional methods that rely on manually defined rules or statistical features for traffic classification [1, 2], deep learning-based approaches can automatically extract useful features from raw network traffic data. In network communication, a session consists of a sequence of packets that carry important information. Consequently, many studies extract different feature sequences for traffic classification [32–35, 54, 56], such as packet length, inter-arrival time (IAT), and packet direction sequences. The sequences formed by these features contain rich information for identifying malicious traffic.
Network traffic inherently exhibits dynamics and distribution diversity [8, 57], making it infeasible for training data to encompass all possible traffic types in the real world. These characteristics require that malicious traffic detection models possess strong out-of-distribution (OOD) generalization. OOD can generally be categorized into covariate shift and semantic shift [8, 59]. In this work, we focus on covariate shift, where the input distribution changes while the label distribution remains unchanged. Owing to the high cost of labeling and high resource consumption involved in collecting network traffic data [21], traffic in datasets is generally collected in artificially established, small-scale, and relatively stable environments [38, 46], leading to discrepancies with real-world traffic and limited diversity. Models trained on such datasets tend to perform well on data following the same distribution as the training data (in-distribution data); however, when the data exhibit a distribution shift from the training data (OOD data), the model performance usually decreases sharply, indicating poor OOD generalization.
Data augmentation is an effective approach for increasing data diversity and improving OOD generalization [19]. As a form of time series data, network traffic feature sequences are amenable to time series augmentation techniques [26]. However, compared with generic time series data, network traffic exhibits more complex variation patterns [57], which limits the effectiveness of conventional time series augmentation techniques.
Time series can be transformed into the frequency domain. In recent years, frequency-domain-based data augmentation has revealed distinct advantages in time series processing [5, 18, 29, 40].
Yuhao Yan, Bo Lang, and Xiangyu Li
These methods identify trend characteristics and perturb data while preserving the key structural information. Inspired by Mixup [61], frequency-domain mixing-based augmentation methods for time series data have been proposed. By mixing frequency-domain representations, they integrate structural information and periodic features to produce diverse samples and have achieved promising results in audio processing and time series forecasting [5, 29]. Nevertheless, such methods lack theoretical analysis and do not consider the unique and complex properties of feature sequences in network traffic, leaving their application to malicious traffic detection a challenge.
Our goal is to enhance the OOD generalization of malicious detection models. We primarily target OOD traffic arising from two scenarios: variations of the same flows across different network environments [57], and similar flows produced by identical or related services. Previous studies have shown that models focusing on low-frequency features tend to be more robust [31, 41, 43]. Accordingly, we leverage frequency-domain mixing to encourage models to focus more on the low-frequency components of flows. We first conduct a theoretical analysis of existing frequency-domain mixing augmentation methods and show that they can be interpreted as matrix transformations in the time domain. Building on this foundation, we identify three problems when applying them to network traffic: (1) Original data with low diversity may fail to generate diverse samples; (2) directly using the frequency-domain mixing ratio to mix inter-class labels may be unsuitable; and (3) network traffic feature sequences are generally nonstationary, which makes the standard Fourier transform prone to distortion. To address these issues, we propose an improved frequency-domain mixing-based augmentation method, which consists of two stages: pre-augmentation and core augmentation. The pre-augmentation stage simulates network variations to preliminarily increase diversity. The core augmentation stage uses linear label mixing for inter-class samples and windowed Fourier transforms to handle nonstationary sequences.
In summary, the main contributions of this paper are as follows:
-
We introduce frequency-domain mixing data augmentation for malicious traffic detection. We first provide a theoretical analysis of this kind of method to illustrate its rationale, and then identify its limitations when applied to network traffic data.
-
Based on our theoretical analysis and the characteristics of network traffic, we propose a new frequency-domain mixing-based data augmentation method for feature sequences of network traffic, addressing these limitations through adding pre-augmentation, changing the label mixing pattern, and applying windowing to the Fourier transform.
-
We conduct extensive experiments on multiple artificial and real-world datasets to evaluate our method. The experimental results show that our proposed method effectively improves the OOD generalization of various mainstream models under different conditions and outperforms other data augmentation methods.
2 Related Work
This section reviews related work on malicious network traffic detection and data augmentation.
2.1 Malicious Network Traffic Detection
Early malicious traffic detection methods relied on handcrafted rules or statistical features [1, 2, 39], which required extensive expert knowledge and struggled to detect unknown attacks. Deep learning-based detection techniques have been increasingly applied to malicious traffic detection, as they can automatically extract features from raw traffic data. Many studies utilize sequence information for traffic classification [4, 23, 32–35, 48, 54, 56]. Liu et al. [35] proposed FS-Net for traffic classification, which is built based on a gated recurrent unit (GRU) and can automatically extract features from packet length sequences. Shen et al. [47] proposed SmartDetector, which utilizes packet length, IAT, and packet direction sequences to construct word embeddings and employs contrastive learning for malicious traffic detection. Although these methods have achieved promising results, they focus primarily on in-distribution (ID) data. In real-world network environments, packet sequences commonly exhibit variations such as reordering, duplication, and aggregation [57], which leads to corresponding changes in the extracted feature sequences. As a result, real-world traffic often comprises OOD and unknown instances, which significantly degrade the performance of these models.
Some studies have focused on the detection of OOD malicious traffic. Han et al. [23] introduced a confidence branch into the classifier and classified traffic with confidence scores below a threshold as malicious, thereby improving the model's ability to detect unknown attacks. Diallo et al. [10] employed an adaptive clustering approach to enhance the robustness of the model. Unlike these approaches that design new models, our method improves OOD generalization through data augmentation.
2.2 Data Augmentation
Data augmentation improves model performance by generating new, semantically consistent samples from existing data and is widely used across various domains [3, 26, 55, 60]. Mixup [61] is a classic general augmentation technique. Its core idea is to generate new samples by performing linear interpolation between two existing samples and their corresponding labels. Given two samples, and , with their respective labels and , Mixup generates a new sample and its label , as follows:
where is the mixing ratio. This operation helps to smooth the decision boundary and improve generalization. Another commonly used augmentation is random masking [9], which masks certain features to prevent the model from overrelying on specific features.
For network traffic data, feature sequences can be treated as time series and are therefore suitable for time series augmentation techniques. Basic time-domain augmentations include scaling, flipping, jittering, and permutation [26]. For time series data, augmentation can be performed in the frequency domain, which can capture and manipulate global structural information and periodic features that are often difficult to obtain in the time domain. Park et al. [40] adopted time warping and frequency masking for audio data augmentation. Drawing on Mixup's idea, both Kim et al. [29] and Chen et al. [5] augmented sequence data by performing mixing in the frequency domain. This approach combines the frequency-domain features of different samples to generate new data. However, they did not provide a theoretical justification for the frequency-domain mixing augmentation. Our subsequent analysis (Section 4.2) will reveal the limitations of this approach.
Data augmentation has also been applied in the field of network traffic classification. Han et al. [23] augmented flow content features and pattern features by setting zero vectors and adding random perturbations, respectively. This approach can mitigate model overfitting, but provides limited improvement in OOD generalization. Xie et al. [57] proposed augmentation operations based on variations caused by network environments and used self-supervised learning to extract invariant features. However, their method is only applicable to packet length sequences, which limits its practicality.
3 Problem Analysis
In this section, we illustrate the problem of low diversity in network traffic datasets through an empirical analysis, investigate its underlying causes and adverse effects on the OOD generalization of malicious traffic detection models, and finally propose ideas to increase data diversity.
3.1 Low Diversity in Network Traffic Datasets
Datasets with low diversity are likely to contain shortcuts. We investigate two widely used datasets, CIC-IDS2017 [46] and CIRA-CIC-DoHBrw2020 (CIC-DoH) [38], and identify several shortcuts that models may exploit. We refer to these features as “shortcuts” because, although they can help models achieve strong performance quickly, they are in fact fragile and non-robust features. Some of the identified shortcuts are illustrated in Figure 1.
In the botnet traffic of CIC-IDS2017, the packet length sequence “[60, 182, 60]” serves as a conspicuous pattern. Simply detecting this pattern via string matching can already achieve a recall of 88.57% and a precision of 93.34%. In CIC-DoH:
-
Malicious flows tend to have much longer durations, meaning that the “relative time from the first packet” of the last packet is typically large (over 500 seconds), whereas most benign flows have significantly shorter durations.
-
The TCP window size often takes on a small set of fixed values; for example, in malicious traffic generated by dnscat2, this value is 501, which is absent in most benign flows.
-
Parsing the “frame.protocols” field via Wireshark reveals that benign traffic uses “eth” at the link layer, whereas malicious traffic uses “ll”.
These features are inherent biases introduced by limitations in the data collection process and are not applicable in real-world scenarios. In practice, a natural packet loss event can easily disrupt the sequence “[60, 182, 60]”; malicious flows do not necessarily exhibit such long durations; TCP window sizes usually fluctuate frequently; the “ll” in link layer is from the use of the Linux Cooked Capture pseudo-protocol and is entirely independent of the actual properties of malicious traffic.
The presence of these shortcuts indicates that the diversity of these datasets is insufficient, such that these inherently fragile features lack diverse variation patterns and instead become key cues for distinguishing malicious traffic. Models trained in this way

Figure 1: Examples of shortcuts we identified in the CICIDS-2017 and CIRA-CIC-DoHBrw2020 datasets.
tend to suffer significant performance degradation in real-world scenarios. In fact, the LUCID model proposed by Doriguzzi-Corin et al. [12] utilizes features including relative time, TCP window size, and “frame.protocols”. Our experiments on dataset (detailed in Section 5) show that LUCID achieves a high F1 score of 94.89% and a low false positive rate (FPR) of 0.53% by leveraging these features; however, simply perturbing or removing these features causes the F1 score to drop below 50% and the FPR to rise above 1%.
In addition to shortcuts, these datasets also exhibit high traffic similarity. For instance, an LSTM trained on only 1% of the CIC-DoH dataset already achieves an F1-score of approximately 93% and an FPR of 1%. We believe such low diversity is a common problem in manually collected network traffic datasets. Beyond the improper experimental setup, we identify two main reasons for the lack of diversity: (1) Inherent network protocol behavior. Many protocols exhibit repetitive patterns. For example, TCP acknowledgment mechanism generates numerous ACK packets, which increases the similarity between different sequences. (2) Large amounts of traffic from the same application or similar services. Traffic generated by the same application or similar services is likely to be highly similar. For example, when a user makes multiple visits to certain web pages, the traffic may have only minor differences in the request body.
These two factors are inherent to network traffic. Due to difficulties in labeling and high resource costs, traffic is generally captured in artificially controlled small-scale environments. This setting may significantly exacerbate the second situation mentioned above, resulting in low diversity of the obtained data. When data diversity is low, deep learning models tend to exploit shortcuts in the data [19]. As evident from our experiments in Sections 5.2 and 5.5, models trained on such datasets often exhibit high ID performance but poor OOD generalization, which severely limits their practical utility.
3.2 Thoughts to Solve the Problem
To enhance the model's OOD generalization, more robust features are required. Some studies have shown that focusing on low-frequency features can make models more robust [31, 41, 43]. In the time domain, low-frequency components typically represent
Yuhao Yan, Bo Lang, and Xiangyu Li
the overall trajectory and trend of a sequence.
We primarily target OOD traffic (represented as packet feature sequences) arising from two scenarios: variations of the same flows across different network environments, and similar flows produced by identical or related services. For example, the former may include packet duplications due to retransmissions or out-of-order arrivals caused by the environment [57] (although TCP protocol can handle issues such as duplication to ensure the consistency of application-layer data, capture usually occurs before the packets enter the network protocol stack), while the latter may include malware and its variants, or applications with similar behaviors. In both cases, the resulting traffic mainly exhibits local variations (e.g., changes and additions) that have minimal effect on the overall trend of the sequence; in other words, their low-frequency components remain relatively similar.
We can obtain frequency-domain representation using the fast Fourier transform (FFT) and transform it back to the time domain using the inverse fast Fourier transform (IFFT). A sequence can be decomposed into low-frequency components capturing smooth trends, and high-frequency components reflecting volatile changes. We use all datasets described in Section 5.1 except (because its small number of malicious traffic samples may introduce substantial bias) to conduct a preliminary experiment to validate the robustness of low-frequency features. For each sample, we generate low- and high-frequency versions by retaining only the first 50% and the last 50% of its frequency-domain components, respectively, and transforming them back to the time domain. The resulting samples are then used to train two separate CNNs for OOD testing. For comparison, we also train a CNN using all frequency components. The experimental results are shown in Fig. 2. Models using only low-frequency features perform comparably to (and sometimes exceed) those using all-frequency features, and consistently outperform those using only high-frequency features. This suggests that low-frequency information is more robust, whereas high-frequency information may sometimes act as interference to some extent.
To force the model to focus on low-frequency features, one idea is to concatenate the low-frequency components of one flow with the high-frequency components of another and then transform it back to the time domain via inverse fast Fourier transform (IFFT). This combination preserves the original flow's low-frequency features while introducing variations through the high-frequency components, thereby perturbing the sequence. Such perturbations may disrupt other non-robust features (especially shortcuts) while keeping the low-frequency features relatively stable. In this way, the model is encouraged to learn the low-frequency characteristics of the data, thus enhancing its robustness. The above approach is an existing frequency-domain mixing data augmentation [5, 29]. However, we find that this method is not directly suitable for network traffic. We will analyze this method and propose improvements based on it in the next section.
We obtain low-frequency features through the FFT and treat them as robust features. Based on these features, we perturb other components to generate augmented samples. Therefore, obtaining robust features is an important part of our method. Currently, feature extraction and representation learning can also be used to obtain data features. However, feature extraction typically relies on manually designed features, while representation learning obtains

Figure 2: F1 scores of CNNs using low-, high-, and all-frequency features for malicious traffic detection.
latent features through model training, with its quality depending on task design and model capacity. Moreover, it is often difficult to identify robust feature components from the features produced by either of these two approaches. Unlike feature extraction or representation learning, our method obtains robust features directly via FFT, without relying on any model or task. Although the assertion of the robustness of low-frequency features is not our contribution, our novelty lies in recognizing the relative stability of overall trends in network traffic, introducing frequency-domain analysis to represent these stable trends as robust low-frequency features, and leveraging this property to design a new input augmentation mechanism for malicious traffic detection.
4 Method
In this section, we first formally define the existing frequency-domain mixing data augmentation method and conduct a theoretical analysis. We further reveal the limitations of this method. Finally, we address these limitations and propose our improved frequency-domain mixing-based augmentation method.
4.1 Theoretical Analysis of the Frequency-Domain Mixing Augmentation Method
4.1.1 Formal Definition. Based on the ideas proposed in Section 3.2, we first introduce the conventional frequency-domain mixing method in a formalized form.
Let and be two different time-domain samples (sequences), each of length , with corresponding labels and . We can obtain their frequency-domain representations, and , by performing the FFT . Since the sequence generated by the FFT has the same length as the original sequence, and also have a length of . For a sequence , we use to denote the element at index , and to denote the subsequence from index up to (but not including) index . The index is 0-based, so a sequence of length has indices from 0 to . For example, if , then and .
We now concatenate their frequency-domain components. Considering that the sequences we process are real-valued, their Fourier transforms possess conjugate symmetry. Therefore, we consider only the first half of the elements in the frequency domain, i.e., those from index 0 to (where denotes the floor function). We randomly select a frequency-domain splitting ratio where , which yields a splitting point . Accordingly, the frequency-domain representation of the new sample is as follows:
The remaining part of is obtained through conjugate symmetry, ensuring that the reconstructed sequence remains a real-valued sequence. For the -th element, we have:
where denotes the complex conjugate. Finally, we apply the IFFT to obtain the new sample in the time domain:
The label of the new sample is also obtained by mixing the labels of the original two samples in the same proportion:
Notably, Kim et al. [29] and Chen et al. [5] applied this frequency-domain mixing in different scenarios, resulting in minor differences between their operations and the operation we present here. However, the core of their methods remains the same, as described by Eqs. (3)–(7). Nevertheless, Kim et al. [29] and Chen et al. [5] described only the algorithm and did not provide a theoretical basis for this approach. We will now analyze this approach theoretically.
4.1.2 Theoretical Analysis. Based on Eqs. (3)–(7) in Section 4.1.1, we set the splitting ratio ; thus, . For convenience, we assume that both and are integers; thus, . We define a sequence of length in the frequency domain, whose -th elements are defined as follows:
and set , where is the all-ones sequence of length . and act as masks, replacing our previous "truncation-concatenation" operation. Let denote the Hadamard product (i.e., elementwise product); then, the frequency-domain mixing operation can be expressed as follows:
We subsequently apply the inverse Fourier transform to X. Since the inverse Fourier transform is linear, we have the following:
According to the convolution theorem, the product in the frequency domain is equivalent to the convolution in the time domain. For finite sequences, the convolution here is cyclic rather than linear.
Let the inverse Fourier transforms of and be and , respectively. Then, the above expression can be transformed into the following form:
where denotes cyclic convolution. This equation indicates that the new sample is actually obtained by superimposing a “perturbation” onto the original sample, which is the convolution of the difference between the two samples and . Notably, here is a deterministic sequence obtained by applying the inverse Fourier transform to .
The form of Eq. (11) is notably similar to the augmentation strategy of Mixup [61]. A comparison of Eq. (1) and Eq. (11) reveals that the augmentation operation of Mixup is actually a special case of frequency-domain mixing augmentation. If we set in Eq. (11), we can obtain exactly the same result as Mixup. In essence, the frequency-domain mixing method generates new samples via convolution.
In Eq. (11), the cyclic convolution operation can be replaced by multiplication with a circulant matrix. If , its corresponding circulant matrix is defined as follows:
For convenience, we represent as column vectors. Eq. (11) can then be rewritten as follows:
Here, is the identity matrix. Assuming that the distribution of the original data is , can be considered a transformed sum of two instances drawn from .
Eq. (13) is the theoretical formulation of the frequency-domain mixing method, showing that frequency-domain mixing performs mixing in the time domain via matrix transformation. The matrix transformation increases the diversity of generated samples and expands their coverage in the feature space, thereby improving generalization. By comparison with Mixup again, we see that Eq. (13) actually replaces the scalar multiplication in Mixup with matrix multiplication. If is set as a diagonal matrix with all diagonal elements equal to , Eq. (13) becomes equivalent to Mixup.

(a) Frequency-domain mixing.
(b) Mixup.
Figure 3: Sample distributions generated by frequency-domain mixing and Mixup.
Yuhao Yan, Bo Lang, and Xiangyu Li
To better illustrate that the matrix transformation in Eq. (13) expands the data distribution, we provide an example with visualization, in which a two-dimensional Gaussian mixture distribution with two components is used as the original distribution, and two data augmentations, frequency-domain mixing and Mixup, are applied respectively to generate new samples. In Figure 3, blue points denote original samples and red points denote augmented samples. As shown in Figure 3a, frequency-domain mixing produces samples with lower density in the high-concentration regions of the original data, while also appearing in areas previously uncovered by the original distribution. We compare frequency-domain mixing with Mixup, as shown in Figure 3b. Mixup generates new samples primarily through linear interpolation, resulting in samples that are not only located within the originally covered regions but also concentrated along the line segments between the two Gaussian components. In contrast, the frequency-domain mixing approach applies a matrix transformation, enabling the new samples to spread across a much broader space.
4.2 Limitations of the Existing Frequency-Domain Mixing Method
Based on the above analysis and the unique characteristics of network traffic, the existing frequency-domain mixing method has the following limitations when applied to malicious traffic detection.
(1) Diminished Effectiveness on Data with Originally Low Diversity. Frequency-domain mixing does not guarantee increased data diversity. If the original data lack diversity and are overly concentrated, the generated samples will likely remain within the regions where the original data are densely distributed. In such cases, the generated samples will be highly similar to existing samples and thus fail to enrich the dataset. For instance, for a multivariate Gaussian distribution, the transformation in Eq. (13) does not alter the mean vector, meaning that the concentration region of the new samples is identical to that of the original data. Consequently, the diversity of the data does not increase. Furthermore, depending on the properties of matrix A, the covariance of the distribution may decrease in some cases. This implies that the newly generated data become more concentrated, with even worse diversity than that of the original data. Such augmentation provides less benefit to the model. Section 3.1 shows that network traffic datasets generally suffer from poor diversity, which limits the effectiveness of the frequency-domain mixing method to some extent.
(2) Inappropriate Inter-Class Label Mixing. With respect to mixing-based data augmentation methods such as Mixup, an inappropriate mixing ratio can negatively impact model performance [36]. Mixup linearly mixes two samples (Eqs. (1)–(2)) and simultaneously mixes their labels according to the same ratio. This intuitive mixing strategy has been proven effective. In the existing frequency-domain mixing method, the label mixing ratio is determined by the proportion of the segment lengths taken from each sample in the frequency domain (Eqs. (3)–(7)). While this process is intuitive in the frequency domain, once the mixed data are transformed back to the time domain, models trained on time-domain data may struggle to capture this relationship. Therefore, this approach may not be appropriate. Considering Eq. (13), if matrix A is a diagonal matrix where all the diagonal elements are , this approach is equivalent
to Mixup with a mixing ratio . However, in frequency-domain mixing, matrix A is a circulant matrix derived from the inverse Fourier transform of the sequence as defined in Eq. (8), which does not have a simple diagonal matrix form. Therefore, directly applying a mixing ratio for inter-class label mixing may have adverse effects.
(3) Negative Impact of Nonstationary Sequences. A nonstationary sequence has frequency components that change over time. In network communications, even within a single session, the local behavior patterns may change according to the specific content, making most network traffic data nonstationary sequences. Applying the Fourier transform to such sequences results in the loss of temporal information and fails to capture the pattern of how frequency components evolve over time. In such cases, frequency-domain mixing may lead to deviations between the retained trend information and the real trend information, thereby degrading model performance.
4.3 Improved Frequency-Domain Mixing-Based Method
4.3.1 Framework. Based on the analysis in Section 4.2, we propose an improved frequency-domain mixing-based method. The following measures are adopted to address the three problems mentioned in Section 4.2: (1) Given that the poor diversity of the original data leads to generated samples being similar to existing samples, we perform pre-augmentation before implementing the core frequency-domain mixing method to preliminarily increase data diversity. (2) To address the problem of an inappropriate mixing ratio for inter-class labels, we avoid frequency-domain mixing for such samples because its transformation matrix is not diagonal, making the appropriate label mixing ratio unclear. Mixup's linear mixing has been widely validated, so we adopt it for inter-class samples. Since intra-class labels remain unchanged regardless of the mixing ratio, frequency-domain mixing is still applied in this case. (3) To address the impact caused by nonstationary sequences, we apply windowing to the Fourier transform, which first windows the sequences and then executes the Fourier transform and conducts frequency-domain mixing augmentation independently within each window.
The overall framework of the proposed method is illustrated in Figure 4. Our method consists of two stages: pre-augmentation and core augmentation. The pre-augmentation stage first extracts packet feature sequences, then applies packet shift and packet variation operations to simulate realistic network changes. The subsequent core augmentation selects two samples each time: if their labels differ, the two samples and their labels are linearly mixed; otherwise, the sequences are divided into windows, and frequency-domain mixing is applied within each window, with the original label preserved. After core augmentation is completed, the final augmented sequences are obtained.
4.3.2 Pre-Augmentation. Prior to the core augmentation stage, we first perform pre-augmentation on the original data. The primary purpose of pre-augmentation is to simulate the variations in real-world network traffic, thereby increasing the diversity of the original data and broadening its distribution to enhance the effectiveness of core augmentation. Generally, elements in a feature sequence are derived from individual packets, meaning that changes in packets

Figure 4: The proposed improved frequency-domain mixing-based method.
lead to corresponding variations in the resulting features. Therefore, we design pre-augmentation approaches based on packet variation patterns to ensure that our method is applicable to a wide range of sequential features. Considering the potential variations in network packets under real-world network conditions [57], we employ two operations for pre-augmentation: packet shift and packet variation. Packet shift randomly shifts the packets at selected positions by certain offsets. Packet variation randomly perturbs certain attributes of packets at the selected positions. We randomly select several positions within a sequence to perform these operations. We constrain these two augmentation operations to small magnitudes. Excessive changes may compromise label consistency between the original and augmented sequences, thereby hindering the effectiveness of the subsequent core augmentation stage.
4.3.3 Core Augmentation. After the pre-augmented data are obtained, we select two samples each to perform our core augmentation operations. If the two samples have different labels, we directly apply linear mixing to the two samples and their labels (Eqs. (1)–(2)). If the two samples share the same label, our windowed frequency-domain mixing method is executed. We first use a windowed Fourier transform to extract the frequency-domain information from the sequences. Given a window length w, the Fourier transform is applied to each subsequence of w elements to acquire the frequency-domain features. For each pair of corresponding windows from the two samples, frequency-domain mixing defined by Eqs. (3)–(5) is performed. An inverse Fourier transform (Eq. (6)) is subsequently applied to each window to transform the result back to the time domain, yielding the final new sequence. The entire data augmentation method is shown in Algorithm 1.
4.3.4 Semantic Preservation of Our Method. Data augmentation generally should not alter the semantics of data. Here, we interpret semantic invariance as the invariance of task-relevant semantics, i.e., the invariance of the true label distribution conditioned on the input sample. In our method, pre-augmentation simulates certain variations in real network traffic and constrains these variations to a small magnitude, thus generally preserving the original semantics; the inter-class linear mixing strategy is the same as Mixup, whose effectiveness has been validated by previous studies [51, 62]. Therefore, we focus on analyzing the semantic preservation of the
intra-class frequency-domain mixing strategy.
In the frequency domain, given a cutoff frequency index l, components with indices smaller than l are regarded as low-frequency components, while the remaining components are regarded as high-frequency components. In the time domain, a sequence x can be decomposed as , where is reconstructed from the
Algorithm 1: Our Data Augmentation Method
Input: Packet feature sequences (padded or truncated to same length) and their labels , window length w, mixing ratio , the ratio of elements to be pre-augmented r
Output: New generated sequence x and its label y // Pre-augmentation
1 Packet_Shift()
2 Packet_Variation() // Core Augmentation
3 if then 4 i ← 0 5 6 7 8 while i < length() do 9 10 // Mix frequency according to Eqs. (3)-(5)
11 Mix_Frequency() 12 13 i ← i + w
14 end
15 end
16 else
17
18
19 end
20 return x, y
Yuhao Yan, Bo Lang, and Xiangyu Li
low-frequency components of , and from the remaining high-frequency components. This decomposition is unique, i.e., there is a one-to-one correspondence between and the pair . Since the Fourier basis functions are mutually orthogonal, modifying the high-frequency components does not affect the low-frequency components and their corresponding time-domain reconstruction , and vice versa. Consequently, when we concatenate the low-frequency components of with the high-frequency components of , the resulting new sample in the time domain can be described as:
Let denote the true label distribution of sample . Since can be uniquely decomposed into the pair , can equivalently be written as . We use the total variation (TV) distance to measure the discrepancy between two distributions, which is commonly used in machine learning theory [44]. We assume that low-frequency features are more robust, meaning that, for most samples, the label distribution can largely be inferred from low-frequency features and is relatively insensitive to variations in the high-frequency components, so that perturbing the high-frequency components does not substantially alter the label distribution. For a given class label , let and be independently drawn from the same class-conditional distribution . This assumption can be formally stated as: there exists a sufficiently small value such that
where denotes the expectation.
The augmented sample is generated from two samples and independently drawn from . According to Eq. (14), the low- and high-frequency sequences in the time-domain decomposition of are and , respectively. Combining this with Eq. (15), the expected discrepancy in the label distribution between and is given by:
Eq. (16) shows that the expected TV distance between the label distribution of our augmented sample and that of the original sample , , is also no more than . This indicates that our frequency-domain mixing strategy generally retains the label distribution of the original sample, thereby preserving the semantics of the augmented sample to a large extent.
5 Experiments
In this section, we conduct extensive experiments on multiple datasets. We evaluate the performance of our method on OOD generalization using both artificial and real-world data. We perform ablation studies to determine the contribution of each component. Moreover, we assess our method's impact on ID generalization. Parameter sensitivity experiments of the mixing ratio and window size can be found in Appendix E.
5.1 Experimental Setup
5.1.1 Datasets and Evaluation Metrics. We use multiple datasets to evaluate our method, including CIRA-CIC-DoHBrw2020 [38] (CIC-DoH), CIC-IDS2017 [46] and CSE-CIC-IDS2018 [15] (CIC-IDS2018). Since these datasets were collected in artificial environments, we additionally employ two real-world datasets for evaluation in practical scenarios: the MAWILab dataset [14] and a real-world dataset (called CSD) provided by our collaborators. These datasets are introduced as follows:
-
CIRA-CIC-DoHBrw2020: A malicious traffic detection dataset collected by the Canadian Institute for Cybersecurity (CIC). It contains a large amount of benign traffic and encrypted malicious traffic based on DoH (DNS over HTTPS).
-
CIC-IDS2017: An intrusion detection dataset collected by the CIC in a controlled environment. It includes various types of malicious attacks, such as botnet, DDoS, and infiltration.
-
CSE-CIC-IDS2018: An intrusion detection dataset collected by the CIC. It is similar to CIC-IDS2017 in terms of basic characteristics; however, it has a larger network scale and more diverse traffic.
-
MAWILab: This dataset is collected by the WIDE project [7]. It is a real-world dataset that contains a large amount of backbone traffic and labels of traffic anomalies obtained using an advanced graph-based methodology.
-
CSD: This is our private dataset collected in real-world network environments. It includes extensive benign traffic, as well as malicious traffic from several monitored suspicious IP addresses.
To meet the needs of evaluating OOD generalization, we partition and reorganize these datasets. In the CIRA-CIC-DoHBrw2020 dataset, benign traffic is generated by pairing two browsers (Chrome and Firefox) with four DoH servers (AdGuard, Cloudflare, Google DNS, and Quad9), yielding eight combinations in total. Malicious traffic is generated by three tools: dns2tcp, dnscat2, and Iodine. In real-world scenarios, users may favor a specific browser or DoH server. Consequently, data generated by other browsers or servers would become "out-of-distribution data". Accordingly, we partition the combinations within the CIRA-CIC-DoHBrw2020 dataset to create three reorganized datasets for experiments, denoted as . For benign traffic, and are partitioned according to browser types and DoH servers, respectively, while adopts a mixed partitioning. Since malicious traffic is generated by three tunneling tools, we select traffic from one or two of these tools to include in the training set each time, while the remaining traffic is assigned to the test set.
In addition, we let the models train on a subset of CIC-IDS2017 and evaluate on a subset of CIC-IDS2018 (this reorganized dataset is denoted as ). The training data and test data of come from almost entirely different environments. Their only similarity is that the types of malicious traffic are approximately the same, thus making it more challenging. For the real-world datasets (denoted as ), we use data collected on one day for training, while data collected on another day serve as test data. Under our data partitioning strategy, the OOD scenarios described in Section 1 are naturally reflected. For example, dataset includes variants where the same DoH server is paired with different browsers; for real-world datasets, although data are split by date, they are collected from the same monitoring nodes and therefore may still contain
Table 1: Partition and reorganization of datasets.
| Original Dataset | Dataset | Partition Criteria | Training Set | Test Set |
|---|---|---|---|---|
| CIC-DoH | Browser | B: FirefoxM: Iodine | B: ChromeM: dns2tcp, dnscat2 | |
| DoH server | B: AdGuard, CloudFlareM: Iodine, dnscat2 | B: Google DNS, Quad9M: dns2tcp | ||
| Mixed partition:the training setcontains traffic frommultiple browsersand DoH servers | B: Chrome_AdGuard,Chrome_CloudFlare,Firefox_Google DNS,Firefox_Qad9M: dns2tcp | B: Chrome_Google DNS,Chrome_Qad9,Firefox_AdGuard,Firefox_CloudFlareM: Iodine, dnscat2 | ||
| CIC-IDS2017,CIC-IDS2018 | Different networkenvironments | July 6th data in CIC-IDS2017(M: web attack, infiltration) | February 22nd data in CIC-IDS2018(M: web attack) | |
| MAWILab | Date | Data collected in May 12th, 2024 | Data collected in May 19th, 2024 | |
| CSD | Date | Data collected in June 2nd, 2024 | Data collected in August 19th, 2024 |
- B: Benign traffic. M: Malicious traffic.
similar flows or flow variants. A detailed summary of all datasets is provided in Table 1. In Table 1, “Chrome_AdGuard” denotes traffic generated by the combination of Chrome and AdGuard, while “Chrome” refers to all traffic involving Chrome in the combinations (i.e., including all four combinations involving Chrome).
We conduct binary classification on the flows within these datasets to detect malicious traffic. We divide the training sets in Table 1 into training, validation, and in-distribution test sets at a ratio of 6:2:2, which allows us to assess the impact of our data augmentation method on the ID data. The test sets in Table 1 are used to evaluate the OOD generalization of the model. As these datasets are imbalanced, we adopt precision, recall, F1 score (F1), and false positive rate (FPR) as our evaluation metrics. Due to space constraints, we report the F1 score (as it provides a balanced assessment of both precision and recall) and the FPR in Section 5. Detailed results including all metrics can be found in Appendix D.
5.1.2 Models and Baselines. Models. We select several models for traffic classification, including three widely used general models and seven specialized models, to evaluate the augmentation effects of our method. The general models are LSTM [25], 1D-CNN [30], and Transformer [53]. These three models are commonly used as fundamental architectures in network traffic classification tasks [22, 35, 49]. The specialized models are:
-
DF [48]: This model employs a carefully designed architecture based on stacked 1D-CNNs for traffic classification.
-
BAPM [20]: This model extracts features through convolutional layers, divides the representations into blocks, and employs a multihead attention mechanism to fuse the information of these blocks for traffic classification.
-
TMWF [28]: This model uses the backbone of DF to extract sequential features and then applies a Transformer-based architecture for traffic classification.
-
LUCID [12]: This model extracts multiple packet attributes as sequential features and structures them into matrices, employing a 2D-CNN for malicious traffic detection.
-
Whisper [16]: This model extracts frequency-domain features for malicious traffic detection and is considered one of the state-of-the-art approaches. While it is originally unsupervised, we
employ the supervised implementation by Yan et al. [58] to leverage label information.
-
MATEC [6]: This model integrates the multi-head attention mechanism with CNNs for traffic classification.
-
SmartDetector [47]: A recently proposed model that transforms packet sequence features into word embedding sequences and incorporates contrastive learning for malicious traffic detection.
Features. Considering that the packet length sequence is a widely adopted and effective feature [13, 27, 35, 42, 57], we employ it for all three generic models. For specialized models, we primarily follow the feature sets used in their original papers (but may make modifications to suit our scenario). In detail, DF, BAPM, and TMWF use packet length sequences; MATEC and SmartDetector use packet length, IAT, and packet direction sequences; Whisper uses packet length and IAT sequences; and LUCID follows the same feature sets as in [12]. We apply the augmentations to packet length and IAT (if available) sequences; for LUCID, the augmentations are applied to packet length, TCP payload length, and UDP payload length sequences. Additionally, for LUCID on datasets , we exclude three features—relative time, frame protocols, and TCP window size—to prevent shortcut exploitation (see Section 3.1).
Baselines. We select six data augmentation methods for comparison. These include two conventional time series augmentation techniques: Jittering [26], which adds noise to the data, and Permutation [26], which shuffles sequence segments. We also compare against two general-purpose methods: Random Masking (RM) [9] and Mixup [61]. Random masking randomly masks elements in the sequence, and Mixup performs linear mixing on two samples and their labels. In addition, we include Standard Frequency-Domain Mixing (FreqMix) [5, 29] described in Section 4.1.1, which mixes the frequency-domain features of time series data. Finally, we adopt an augmentation method designed for traffic classification, Rosetta [57]. Rosetta employs contrastive learning to minimize the distance between a packet length sequence and its augmented version, thereby training a robust feature extractor to obtain more stable representations. We denote our augmentation method as “Ours” and the case without data augmentation as “NoAug”.
More details, including the implementation of pre-augmentation and parameter settings, can be found in Appendix C.
Yuhao Yan, Bo Lang, and Xiangyu Li
Table 2: Comparison of different data augmentation methods on artificial datasets.
| Model | Dataset | NoAug | Jittering | Permutation | RM | Mixup | FreqMix | Rosetta | Ours | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| F1 ↑ | FPR ↓ | F1 ↑ | FPR ↓ | F1 ↑ | FPR ↓ | F1 ↑ | FPR ↓ | F1 ↑ | FPR ↓ | F1 ↑ | FPR ↓ | F1 ↑ | FPR ↓ | F1 ↑ | FPR ↓ | ||
| LSTM | 0.7429 | 0.0018 | 0.7331 | 0.0019 | 0.6954 | 0.0025 | 0.6951 | 0.0028 | 0.8752 | 0.0136 | 0.9259 | 0.0134 | 0.6582 | 0.0129 | 0.9528 | 0.0171 | |
| 0.3865 | 0.0006 | 0.6724 | 0.0011 | 0.5567 | 0.0002 | 0.4692 | 0.0011 | 0.9039 | 0.0027 | 0.8588 | 0.0032 | 0.5623 | 0.0125 | 0.9182 | 0.0045 | ||
| 0.5794 | 0.0001 | 0.5935 | 0.0001 | 0.7996 | 0.0002 | 0.6126 | 0.0012 | 0.6943 | 0.0006 | 0.7252 | 0.0012 | 0.7534 | 0.0148 | 0.8149 | 0.0035 | ||
| 0 | - | 0 | - | 0 | - | 0 | - | 0 | - | 0 | - | 0 | - | 0 | - | ||
| 1D-CNN | 0.7328 | 0.0056 | 0.7505 | 0.0062 | 0.7563 | 0.0080 | 0.7328 | 0.0097 | 0.7779 | 0.0183 | 0.7158 | 0.0187 | 0.7503 | 0.0165 | 0.8001 | 0.0358 | |
| 0.6047 | 0.0063 | 0.6073 | 0.0064 | 0.6003 | 0.0082 | 0.5945 | 0.0130 | 0.6042 | 0.0153 | 0.6118 | 0.0145 | 0.5680 | 0.0257 | 0.6533 | 0.0571 | ||
| 0.8202 | 0.0041 | 0.7702 | 0.0046 | 0.7477 | 0.0057 | 0.8276 | 0.0091 | 0.8682 | 0.0149 | 0.9263 | 0.0098 | 0.8318 | 0.0288 | 0.9301 | 0.0253 | ||
| 0.0109 | 0.0013 | 0.0114 | 0.0007 | 0 | - | 0.0110 | 0.0011 | 0.0112 | 0.0009 | 0.0112 | 0.0008 | 0.5126 | 0.0008 | 0.5714 | 0.0011 | ||
| Transformer | 0.7405 | 0.0060 | 0.7399 | 0.0065 | 0.6677 | 0.0039 | 0.7210 | 0.0246 | 0.8026 | 0.0050 | 0.8578 | 0.0165 | 0.6288 | 0.0106 | 0.9014 | 0.0201 | |
| 0.5692 | 0.0039 | 0.5690 | 0.0043 | 0.6114 | 0.0040 | 0.6266 | 0.0063 | 0.7559 | 0.0047 | 0.8005 | 0.0074 | 0.5827 | 0.0157 | 0.9144 | 0.0111 | ||
| 0.7059 | 0.0012 | 0.6734 | 0.0013 | 0.5659 | 0.0007 | 0.6027 | 0.0018 | 0.7530 | 0.0005 | 0.7602 | 0.0022 | 0.7808 | 0.0145 | 0.7818 | 0.0021 | ||
| 0 | - | 0 | - | 0 | - | 0 | - | 0 | - | 0 | - | 0.3306 | 0.0105 | 0.3799 | 0.0108 | ||
| DF | 0.7156 | 0.0109 | 0.7228 | 0.0086 | 0.7703 | 0.0038 | 0.6851 | 0.0038 | 0.6975 | 0.0023 | 0.7513 | 0.0074 | 0.6256 | 0.0122 | 0.8210 | 0.0071 | |
| 0.7342 | 0.0028 | 0.5772 | 0.0025 | 0.7800 | 0.0024 | 0.6349 | 0.0067 | 0.7344 | 0.0024 | 0.6085 | 0.0035 | 0.5895 | 0.0101 | 0.8446 | 0.0080 | ||
| 0.6379 | 0.0003 | 0.6390 | 0.0005 | 0.5770 | 0.0007 | 0.6806 | 0.0011 | 0.6856 | 0.0003 | 0.7002 | 0.0024 | 0.7550 | 0.0115 | 0.7226 | 0.0007 | ||
| 0 | - | 0 | - | 0 | - | 0 | - | 0 | - | 0 | - | 0.2837 | 0.0001 | 0.0854 | 0.0919 | ||
| BAPM | 0.7058 | 0.0084 | 0.7310 | 0.0084 | 0.7336 | 0.0109 | 0.7623 | 0.0047 | 0.7755 | 0.0051 | 0.7416 | 0.0662 | 0.6814 | 0.0125 | 0.8163 | 0.0495 | |
| 0.5783 | 0.0051 | 0.5064 | 0.0032 | 0.5675 | 0.0112 | 0.5734 | 0.0178 | 0.6902 | 0.0041 | 0.7022 | 0.0124 | 0.5909 | 0.0153 | 0.7054 | 0.0523 | ||
| 0.6764 | 0.0008 | 0.6414 | 0.0008 | 0.5689 | 0.0014 | 0.6422 | 0.0014 | 0.7039 | 0.0009 | 0.6444 | 0.0034 | 0.7982 | 0.0190 | 0.8121 | 0.0238 | ||
| 0.1390 | 0.0498 | 0.0062 | 0.0120 | 0.2616 | 0.0188 | 0.1280 | 0.0555 | 0.0052 | 0.0167 | 0 | - | 0.2230 | 0.0245 | 0.3833 | 0.0302 | ||
| TMWF | 0.8323 | 0.0162 | 0.7865 | 0.0042 | 0.7280 | 0.0026 | 0.7131 | 0.0028 | 0.7735 | 0.0015 | 0.8003 | 0.0071 | 0.6084 | 0.0150 | 0.9059 | 0.0166 | |
| 0.7617 | 0.0018 | 0.6949 | 0.0029 | 0.8199 | 0.0023 | 0.6874 | 0.0047 | 0.7308 | 0.0009 | 0.7819 | 0.0032 | 0.5550 | 0.0090 | 0.8366 | 0.0036 | ||
| 0.6815 | 0.0003 | 0.6654 | 0.0002 | 0.6493 | 0.0006 | 0.6862 | 0.0015 | 0.7138 | 0.0001 | 0.6948 | 0.0007 | 0.7658 | 0.0115 | 0.7463 | 0.0014 | ||
| 0 | - | 0 | - | 0 | - | 0 | - | 0 | - | 0 | - | 0 | - | 0.4963 | 0.0183 | ||
| LUCID | 0.3247 | 0.0116 | 0.3317 | 0.0090 | 0.3090 | 0.0092 | 0.3306 | 0.0100 | 0.3185 | 0.0072 | 0.4157 | 0.0176 | / | / | 0.4285 | 0.0082 | |
| 0.3104 | 0.0150 | 0.3077 | 0.0097 | 0.1653 | 0.0060 | 0.3063 | 0.0165 | 0.2704 | 0.0092 | 0.2064 | 0.0062 | / | / | 0.3973 | 0.0093 | ||
| 0.7896 | 0.0115 | 0.7493 | 0.0185 | 0.7464 | 0.0385 | 0.7924 | 0.0178 | 0.8212 | 0.0059 | 0.8215 | 0.0062 | / | / | 0.8245 | 0.0071 | ||
| 0 | - | 0 | - | 0 | - | 0 | - | 0 | - | 0 | - | / | / | 0 | - | ||
| Whisper | 0.7211 | 0.0043 | 0.2843 | 0.0027 | 0.2999 | 0.0040 | 0.7909 | 0.0044 | 0.3001 | 0.0011 | 0.4157 | 0.0176 | / | / | 0.8222 | 0.0109 | |
| 0.7553 | 0.0031 | 0.7465 | 0.0022 | 0.7320 | 0.0031 | 0.7603 | 0.0045 | 0.0876 | 0.0030 | 0.2578 | 0.0075 | / | / | 0.7969 | 0.0086 | ||
| 0.8173 | 0.0042 | 0.8495 | 0.0054 | 0.8470 | 0.0063 | 0.7854 | 0.0194 | 0.7894 | 0.0045 | 0.8231 | 0.0201 | / | / | 0.9077 | 0.0240 | ||
| 0 | - | 0 | - | 0 | - | 0 | - | 0 | - | 0 | - | / | / | 0 | - | ||
| MATEC | 0.2974 | 0.1108 | 0.2937 | 0.1115 | 0.2728 | 0.1106 | 0.2668 | 0.1651 | 0.3148 | 0.1624 | 0.4158 | 0.0887 | / | / | 0.8312 | 0.1635 | |
| 0.1469 | 0.0015 | 0.1458 | 0.0017 | 0.1584 | 0.0028 | 0.1350 | 0.0026 | 0.2157 | 0.0010 | 0.4080 | 0.0027 | / | / | 0.9748 | 0.0014 | ||
| 0.8909 | 0.0008 | 0.9175 | 0.0041 | 0.7287 | 0.0051 | 0.8430 | 0.0078 | 0.9248 | 0.0004 | 0.8967 | 0.0030 | / | / | 0.9379 | 0.0005 | ||
| 0.3396 | 0.0008 | 0.3333 | 0.0011 | 0.3915 | 0.0018 | 0.3349 | 0.0010 | 0.2939 | 0.0033 | 0.3318 | 0.0011 | / | / | 0.5199 | 0.0030 | ||
| SmartDetector | 0.9935 | 0.0017 | 0.7209 | 0.0781 | 0.9928 | 0.0002 | 0.9951 | 0.0029 | 0.9557 | 0.0024 | 0.9677 | 0.0074 | / | / | 0.9992 | 0.0006 | |
| 0.9977 | 0 | 0.8396 | 0.0003 | 0.9931 | 0 | 0.9877 | 0 | 0.9627 | 0.0003 | 0.9698 | 0 | / | / | 0.9999 | 0 | ||
| 0.9994 | 0.0002 | 0.9823 | 0.0001 | 0.9999 | 0 | 0.9998 | 0 | 0.9673 | 0 | 0.9957 | 0.0002 | / | / | 0.9996 | 0.0001 | ||
| 0 | - | 0.5353 | 0.0024 | 0 | - | 0 | - | 0.3820 | 0.0106 | 0.2618 | 0.0238 | / | / | 0.4260 | 0.0076 | ||
- The best results among the different methods are marked in bold, and the second-best results are underlined. We mark the FPR as “-” when the F1 score is 0 (as FPR is meaningless in this case). Rosetta cannot be applied to models utilizing features other than packet length, so we mark this case as “/”.
5.2 Evaluation in Artificial Environment
We first evaluate the effectiveness of our method in improving the model's OOD generalization in artificial environments (), and compare it with other augmentation methods. Data collected in artificial environments have more reliable labels and less noise. The results are presented in Table 2. More detailed metrics for our method can be found in Table 6 in Appendix D.
As shown in Table 2, applying our data augmentation method typically improves the model's OOD generalization compared to training without augmentation. In many cases, the improvements are substantial, with the F1 score increasing by more than 10%. On dataset with the LSTM model, the improvement in F1 even exceeds 50%. Table 2 shows that our method leads to a slight increase in the FPR. Combined with the results in Table 6, it can be observed that our method usually enhances the recall by identifying more malicious samples, which consequently introduces some additional false positives. To further investigate the impact of our method on FPR, we select four representative models: the general sequence model LSTM, the general attention-based model Transformer, the
classical CNN-based traffic classification model DF, and the state-of-the-art model SmartDetector. For each model, we plot the ROC curves of the models trained with our method (Ours) and with no augmentation (NoAug) on dataset to analyze the true positive rate (TPR, i.e., recall) under different FPR levels. The results are shown in the top row of Figure 5.
Compared with training without data augmentation, our method yields slightly lower TPR for LSTM, Transformer, and DF when the FPR is below approximately 0.1%, 0.5%, and 0.3%, respectively. Once the allowable FPR exceeds these levels (as is often still acceptable in practical scenarios), our method gradually gains a clear advantage. For SmartDetector, our method almost consistently outperforms training without augmentation at the same FPR level.
Compared to other approaches, our method achieves the best F1 scores in most cases. For example, on dataset with the Transformer model, our method achieves an F1 score of 0.9144, while the highest F1 score from any other method is 0.8005. Although our method shares some similarities with Mixup and FreqMix, it performs notably better than them. Moreover, compared to the non-augmented models, our method consistently improves the F1
Table 3: Comparison of different data augmentation methods on real-world datasets.
| Model | Dataset | NoAug | Jittering | Permutation | RM | Mixup | FreqMix | Rosetta | Ours | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| F1 | FPR | F1 | FPR | F1 | FPR | F1 | FPR | F1 | FPR | F1 | FPR | F1 | FPR | F1 | FPR | ||
| LSTM | 0.7657 | 0.1831 | 0.7295 | 0.1987 | 0.7249 | 0.2096 | 0.7495 | 0.2117 | 0.7674 | 0.1737 | 0.7534 | 0.1785 | 0.6139 | 0.2439 | 0.7677 | 0.1597 | |
| 0.7499 | 0.1574 | 0.6877 | 0.1116 | 0.6994 | 0.1665 | 0.7579 | 0.1485 | 0.7521 | 0.1337 | 0.7596 | 0.1429 | 0.5664 | 0.2764 | 0.7623 | 0.1320 | ||
| 1D-CNN | 0.5701 | 0.1763 | 0.5732 | 0.1985 | 0.5142 | 0.2778 | 0.5590 | 0.1968 | 0.5706 | 0.2334 | 0.5518 | 0.2080 | 0.5569 | 0.2551 | 0.5641 | 0.2523 | |
| 0.6240 | 0.2457 | 0.5967 | 0.2788 | 0.4969 | 0.3522 | 0.5589 | 0.2184 | 0.6043 | 0.2438 | 0.5982 | 0.2507 | 0.4309 | 0.2745 | 0.6199 | 0.3293 | ||
| Transformer | 0.6983 | 0.1929 | 0.6884 | 0.1989 | 0.6757 | 0.2263 | 0.7089 | 0.2007 | 0.7168 | 0.2042 | 0.6936 | 0.2412 | 0.6354 | 0.2562 | 0.7270 | 0.2122 | |
| 0.6780 | 0.1599 | 0.6459 | 0.2104 | 0.6045 | 0.2418 | 0.6933 | 0.1643 | 0.6922 | 0.1697 | 0.6724 | 0.1704 | 0.5794 | 0.2676 | 0.7027 | 0.1992 | ||
| DF | 0.7063 | 0.1825 | 0.7157 | 0.1900 | 0.6916 | 0.2415 | 0.7015 | 0.2085 | 0.7296 | 0.2072 | 0.7205 | 0.2057 | 0.5785 | 0.2479 | 0.7387 | 0.1733 | |
| 0.7499 | 0.1415 | 0.7140 | 0.2081 | 0.6569 | 0.1759 | 0.6607 | 0.1191 | 0.7439 | 0.1476 | 0.7190 | 0.1476 | 0.5392 | 0.2463 | 0.7523 | 0.1343 | ||
| BAPM | 0.6747 | 0.2394 | 0.6637 | 0.2151 | 0.6199 | 0.3113 | 0.6610 | 0.2340 | 0.6667 | 0.2493 | 0.6669 | 0.2613 | 0.6093 | 0.2683 | 0.6881 | 0.2073 | |
| 0.7204 | 0.1662 | 0.6638 | 0.2657 | 0.5725 | 0.3190 | 0.6621 | 0.1550 | 0.7143 | 0.1742 | 0.6918 | 0.1567 | 0.4996 | 0.2057 | 0.7285 | 0.1846 | ||
| TMWF | 0.7292 | 0.1866 | 0.7079 | 0.1826 | 0.6951 | 0.2336 | 0.7170 | 0.1903 | 0.7266 | 0.1888 | 0.7258 | 0.2026 | 0.5415 | 0.1287 | 0.7320 | 0.1848 | |
| 0.7276 | 0.1387 | 0.6861 | 0.1584 | 0.6331 | 0.1589 | 0.7202 | 0.1319 | 0.7306 | 0.1307 | 0.7312 | 0.1292 | 0.5106 | 0.2517 | 0.7393 | 0.1412 | ||
| LUCID | 0 | - | 0 | - | 0 | - | 0 | - | 0 | - | 0 | / | / | / | 0 | - | |
| 0.3593 | 0.0496 | 0.2932 | 0.0358 | 0.2884 | 0.0365 | 0.3099 | 0.0385 | 0.2778 | 0.0359 | 0.1844 | 0.0179 | / | / | 0.3378 | 0.0446 | ||
| Whisper | 0.4315 | 0.2024 | 0.3818 | 0.1959 | 0.3346 | 0.2657 | 0.4118 | 0.2464 | 0.4644 | 0.1679 | 0.2518 | 1 | / | / | 0.4850 | 0.1682 | |
| 0.2550 | 0.1052 | 0.1989 | 0.0788 | 0.2328 | 0.0957 | 0.2274 | 0.0911 | 0.2579 | 0.1090 | 0 | - | / | / | 0.6338 | 0.0516 | ||
| MATEC | 0.7024 | 0.2365 | 0.7145 | 0.2191 | 0.6358 | 0.2305 | 0.6954 | 0.2290 | 0.7215 | 0.2110 | 0.7177 | 0.2239 | / | / | 0.7247 | 0.2032 | |
| 0.6845 | 0.2213 | 0.6607 | 0.1965 | 0.5396 | 0.4725 | 0.6607 | 0.1965 | 0.6936 | 0.2219 | 0.6876 | 0.2403 | / | / | 0.6857 | 0.2241 | ||
| SmartDetector | 0.3871 | 0.2675 | 0.2874 | 0.4854 | 0.3247 | 0.3331 | 0.4074 | 0.2451 | 0.3762 | 0.3264 | 0.3697 | 0.2925 | / | / | 0.4769 | 0.2052 | |
| 0.7735 | 0.0906 | 0.7770 | 0.1420 | 0.7546 | 0.0865 | 0.7604 | 0.1554 | 0.7987 | 0.0866 | 0.7425 | 0.1033 | / | / | 0.8157 | 0.0991 | ||
The best results among the different methods are marked in bold, and the second-best results are underlined. We mark the FPR as “-” when the F1 score is 0 (as FPR is meaningless in this case). Rosetta cannot be applied to models utilizing features other than packet length, so we mark this case as “/”.

Figure 5: ROC curves of some representative models on the artificial dataset (top row) and the real-world dataset (bottom row). Insets show enlarged views of some key regions for detailed comparison.
score (except for some cases on where all methods are ineffective), whereas other methods sometimes degrade performance. On dataset with TMWF, Mixup and FreqMix reduce the F1 score by 5.88% and 3.2%, respectively, whereas our method boosts it by 7.36%. Even for models like SmartDetector, which already achieves F1 scores of over 99% without augmentation, our method can still enhance its F1 scores while simultaneously reducing the FPRs. This suggests that our method is more suitable for network packet sequence data and that the generated new samples enable the models to better adapt to variations in network traffic. Rosetta outperforms our method in a few cases because it employs a feature extractor trained with contrastive learning [57], whereas our method is non-learning-based. However, Rosetta is trained exclusively on packet length sequence and can only be applied to models that rely
solely on packet length sequences as features, which significantly constrains its applicability.
To provide a more comprehensive evaluation of FPR, we also plot the ROC curves of Mixup in Figure 5, as Mixup achieves relatively strong performance in both F1 and FPR among all baselines. Overall, similar to the comparison with training without augmentation, Mixup may perform slightly better than our method at very low FPR levels (e.g., below approximately 0.1% for LSTM), whereas our method shows an advantage in most other cases. Although Mixup performs better than our method on Transformer when the FPR is below approximately 1%, this advantage disappears once the acceptable FPR exceeds this level. When a high TPR is required (e.g., 80%), our method can usually achieve it with a lower FPR, significantly outperforming both Mixup and training without augmentation.
Yuhao Yan, Bo Lang, and Xiangyu Li

Figure 6: Results of the ablation study. For better visualization, the FPR axis may start from negative values.
is a more challenging dataset, characterized by less training data and more severe distribution shifts. As a result, the original training set may not sufficiently support the model in learning robust features, often leading to the failure of non-augmented models. However, with our augmentation method, the detection capability can be partially recovered in many cases, whereas other methods typically remain ineffective or perform poorly. On TMWF, while all other methods fail, our approach improves the F1 score to 0.4963. For cases where all augmentations remain ineffective, we attribute this to the models' limited capabilities. Jittering performs well on SmartDetector in , which may be attributed to the possibility that features extracted from its augmented data happen to align with those of the OOD samples.
5.3 Evaluation in Real-World Environment
To better understand the practicality of our method, we evaluate it on two datasets ( and ) collected in real-world network environments. Traffic collected in real-world environments may suffer from inaccurate labeling (especially on MAWLab, i.e., ). Moreover, since the training and test sets are collected on different dates, the distribution shift is more pronounced. The evaluation is similar to that in Section 5.2, and the results are shown in Table 3. More detailed metrics for our method can be found in Table 6 in Appendix D.
Compared to the non-augmented baseline, our method enhances the F1 score in most cases without significantly increasing the FPR; in many instances, our method even reduces the FPR. Our method also demonstrates advantages over other data augmentation techniques. For the Whisper model on dataset , our approach increases the F1 score from 0.255 to 0.6338 and reduces the FPR from 0.1052 to 0.0516. In contrast, Mixup, the best-performing baseline, only improves the F1 score to 0.2579 and even increases the FPR. For the 1D-CNN model, most augmentations reduce the F1 score, which may indicate that 1D-CNN is not well adapted to the variations introduced by data augmentations and instead treats them as noise. LUCID fails on , possibly because some of the features it uses are not informative on this dataset (e.g., relative time from the
first packet), thereby impairing its detection capability. Whisper leverages frequency-domain features for detection, whereas FreqMix performs poorly on Whisper, yielding an FPR of 1 on and failing on . This suggests that FreqMix's mixing strategy may be overly simplistic, thereby disrupting Whisper's ability to capture informative frequency-domain features. Overall, our approach still shows some effectiveness on real-world datasets and improves the generalization of detection models in practical environments.
Similar to Section 5.2, we plot the ROC curves of several representative models to investigate the impact of FPR, as shown in the bottom row of Figure 5. We choose dataset because, on , our method improves FPR in most cases. As shown in Figure 5, the ROC curves on the real-world dataset are generally closer to each other, especially at low FPR levels, indicating that the performance differences among these methods are relatively small. Nevertheless, our method still shows some advantage on SmartDetector. Our method also consistently achieves slightly better performance on LSTM. Unlike the artificial dataset, our method can outperform the model trained without augmentation even at very low FPR levels on the real-world dataset.
The analysis on both the artificial and real-world datasets in Figure 5 indicates that it is feasible to constrain the FPR of our method to a desired level by adjusting the decision threshold. This provides a way to balance FPR and TPR for our method. Under the same FPR level, our method outperforms the model without augmentation in most cases, thereby still remaining effective in improving the model's performance. In practical applications, we recommend evaluating our method on a validation set according to the target requirements and adjusting the decision threshold to achieve an acceptable FPR-TPR trade-off for better deployment.
5.4 Ablation Study
To verify the contribution of each component in our method, we conduct an ablation study. To eliminate the potential interference from data scarcity and label noise, we perform experiments on dataset . The experimental results are presented in Figure 6. "Full Setting" refers to our complete data augmentation method.
Table 4: Model performance on in-distribution data before and after applying our proposed data augmentation method.
| Model | Aug | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| F1↑ | FPR↓ | F1↑ | FPR↓ | F1↑ | FPR↓ | F1↑ | FPR↓ | F1↑ | FPR↓ | F1↑ | FPR↓ | ||
| LSTM | NoAugOurs | 0.99820.9872 | 0.00020.0037 | 0.99880.9965 | 0.00030.0017 | 0.99800.9791 | 0.00030.0037 | 0.83780.5733 | 0.00200.0105 | 0.92140.9211 | 0.07920.0607 | 0.90100.9088 | 0.06900.0556 |
| 1D-CNN | NoAugOurs | 0.98290.9297 | 0.00290.0238 | 0.98490.9509 | 0.00540.0341 | 0.95670.8623 | 0.00480.0223 | 0.47790.3093 | 0.00200.0004 | 0.71150.6983 | 0.16780.2467 | 0.73700.7069 | 0.13890.1955 |
| Transformer | NoAugOurs | 0.99320.9828 | 0.00130.0053 | 0.99460.9920 | 0.00140.0055 | 0.99110.9879 | 0.00170.0027 | 0.70750.6929 | 0.00560.0008 | 0.86700.8923 | 0.10920.1108 | 0.83250.8590 | 0.07790.0954 |
| DF | NoAugOurs | 0.99680.9898 | 0.00060.0022 | 0.99790.9899 | 0.00080.0054 | 0.99640.9888 | 0.00040.0006 | 0.80580.6923 | 0.00080.0116 | 0.88070.8862 | 0.10150.1070 | 0.88430.9000 | 0.05830.0578 |
| BAPM | NoAugOurs | 0.99460.9606 | 0.00090.0141 | 0.99610.9580 | 0.00200.0312 | 0.99370.9206 | 0.00110.0268 | 0.75950.6286 | 0.00680.0060 | 0.85070.8503 | 0.14620.1238 | 0.84870.8481 | 0.08260.0803 |
| TMWF | NoAugOurs | 0.99620.9779 | 0.00110.0073 | 0.99820.9942 | 0.00040.0019 | 0.99570.9785 | 0.00050.0016 | 0.80500.6222 | 0.00560.0048 | 0.89260.8909 | 0.10720.0961 | 0.88570.8937 | 0.06300.0604 |
| LUCID | NoAugOurs | 0.88710.8873 | 0.00480.0041 | 0.94650.9047 | 0.01500.0097 | 0.95480.9610 | 0.01230.0066 | 00 | -0 | 00 | -- | 0.48030.4683 | 0.03360.0337 |
| Whisper | NoAugOurs | 0.99020.9638 | 0.00060.0046 | 0.99240.9715 | 0.00180.0081 | 0.99390.9807 | 0.00190.0133 | 00 | -0 | 0.84690.8459 | 0.17940.1584 | 0.15210.7369 | 0.03600.0315 |
| MATEC | NoAugOurs | 0.99330.9967 | 0.00030.0001 | 0.99520.9971 | 0.00060.0004 | 0.99650.9976 | 0.00060.0005 | 0.76920.8267 | 0.00280.0028 | 0.88610.8963 | 0.12370.0995 | 0.85660.8782 | 0.09490.0836 |
| SmartDetector | NoAugOurs | 0.99900.9999 | 0.00010 | 0.99990.9999 | 00.0001 | 0.99980.9999 | 0.00010 | 0.73970.8112 | 0.00440.0016 | 0.85890.8850 | 0.12760.1309 | 0.89780.9186 | 0.03210.0290 |
- Aug: Augmentation. NoAug: No augmentation.
** The best results are marked in bold. We mark the FPR as “-” when the F1 score is 0 (as FPR is meaningless in this case).
“w/o Linear Mixing” means that when the selected two samples have different labels, frequency-domain mixing is used instead, while the other components remain the same as in the full setting. “w/o Pre-Aug” removes the pre-augmentation component from the full setting. “w/o Windowing” keeps the other components the same but does not perform windowing.
Figure 6 shows that the contribution of each component varies under different conditions. In most cases, the full setting achieves the best performance. This indicates that the combination of pre-augmentation, inter-class linear mixing, and windowing works synergistically to improve model performance. Compared to other settings, the full setting may lead to an increased FPR, as it enhances the model's ability to identify malicious samples to a greater extent, thereby introducing some additional false positives. However, in many cases, the FPR under the full setting is not the highest. This suggests that the combination of these operations is in fact beneficial for suppressing the rise in FPR.
Removing linear mixing typically leads to a substantial drop in F1, highlighting the importance of maintaining inter-class linear mixing and thereby validating limitation (2) proposed in Section 4.2. Removing pre-augmentation and windowing has a relatively smaller impact on the F1 score, but can still degrade the performance in most cases. In certain scenarios, such as MATEC on dataset , they are critical components. Both pre-augmentation and windowing contribute to improving the stability of our method. Furthermore, windowing appears to have a significant effect on the FPR; in many cases, its removal results in a sharp increase in FPR. In our augmentation, windowing enables the model to better focus on the local behaviors of packet feature sequences, which may allow more precise identification of malicious traffic and thus reduce the FPR.
5.5 Impact on In-Distribution Generalization
Our data augmentation method introduces certain variations to the samples, which facilitates the learning of more robust features.
However, Tsipras et al. [52] reported that leveraging more robust features does not necessarily improve the model's accuracy on standard data (i.e., in-distribution data in our experiments). In some cases, especially in adversarial training, there can be a trade-off between OOD generalization and ID generalization. To investigate the impact of our augmentation on the model's ID generalization, we evaluate the performance of each model on ID data before and after augmentation. The results are presented in Table 4. More detailed metrics can be found in Table 7 in Appendix D.
As shown in Table 4, models generally achieve good performance on ID data without data augmentation. By comparing the data across Table 2, Table 3, and Table 4, we observe that although the models perform well on ID data without augmentation, their performance decreases significantly when they face a distribution shift. Table 4 also shows that while our data augmentation improves OOD generalization, it may lead to a decrease in performance on ID data. However, this degradation is often minor: in many cases, the F1 score decreases by less than 3%, and the FPR increases by less than 0.5%. Moreover, our method can actually improve ID performance in a number of cases. Notably, the F1 score variations on are more pronounced compared to other datasets, which can be attributed to its relatively small test set size (only 81 malicious samples). The phenomenon of performance degradation on ID data closely resembles the trade-off observed in adversarial training, where improved adversarial accuracy (OOD performance in our situation) comes at the cost of reduced standard accuracy (ID performance in our situation) [45, 50, 52]. Generally, adversarial samples can be regarded as worst-case OOD data [19]. In our experiments, this phenomenon suggests that some augmented samples might act like adversarial samples. Drawing a parallel to adversarial training, and considering that our method significantly improves OOD generalization while having only a minor impact on ID performance, we argue that this trade-off is worthwhile, as it enhances the model's practical applicability in real-world scenarios.
Yuhao Yan, Bo Lang, and Xiangyu Li
6 Discussion
Biases of data augmentation. Our augmentation may generate samples that would not occur in reality, potentially introducing some biases to the actual data. However, during frequency-domain mixing between intra-class samples, our goal is to encourage the model to focus on low-frequency features. Although some generated samples may not exist in reality, they preserve the relative stability of the low-frequency components and still help the model learn robust low-frequency representations. As for the linear mixing between inter-class samples, this is essentially the idea of Mixup, which has proven effective in prior studies [51, 62].
Applicability of our method. In principle, our method is applicable to most numerical sequence features, such as packet length sequences and IAT sequences. Categorical features, such as protocol types, are not suitable for our approach. A potential concern is whether the augmentation might disrupt the correlations among features when a model utilizes multiple features simultaneously. Our intuition is that, for a given packet, the correlations between different features are usually weak. For example, the protocol may have some influence on packet length, but it is far from being determinative. Moreover, our experiments in Section 5 demonstrate that augmenting only the applicable features remains effective. Exploring the impacts of cross-feature correlations is a possible direction for future work.
Robustness against evasion attacks. Attackers may employ various techniques to evade detection. As defending against such attacks is beyond the primary scope of this paper, we have not evaluated our method in specific evasion scenarios. However, given the parallels between our approach and adversarial training discussed in Section 5.5, we believe that our method may offer a certain degree of robustness against evasion attacks, much like adversarial training can defend against adversarial examples. This is also a potential direction for future work.
Limitations of our method. First, our method has limited effectiveness on very short packet sequences. This is because shorter sequences provide fewer frequency components for mixing, which constrains the diversity of the augmented samples. We apply windowing to reduce the requirement for sequence length and recommend using sequences consisting of at least six packets. Furthermore, our method aims to enhance the model's ability to recognize the OOD flows described in Section 3.2, and may be ineffective against severely drifted flows that differ substantially (particularly in their low-frequency components) from the training traffic.
7 Conclusion
In this paper, we introduce the frequency-domain mixing data augmentation method into malicious traffic detection to improve the out-of-distribution generalization ability of detection models. We first provide a theoretical analysis of this approach and identify its limitations in supporting network traffic classification. Based on this analysis, we propose an improved augmentation method for network packet feature sequences. Our method incorporates a pre-augmentation step to increase data diversity, and adopts a new mixing strategy in which both samples and labels are linearly mixed for inter-class samples, whereas frequency-domain mixing is applied for intra-class samples. In addition, we employ a windowed Fourier transform for frequency-domain conversion to accommodate the nonstationarity of network traffic sequences. We conduct extensive experiments on multiple artificial and real-world datasets, and the results demonstrate that our method can significantly improve the out-of-distribution generalization ability of malicious traffic detection models and outperforms other data augmentation methods. The improvement in the out-of-distribution generalization ability enables the model to better handle the complex network traffic in real-world environments. In future work, we plan to explore better frequency-domain mixing schemes for network traffic data augmentation.
References
[1] Blake Anderson and David A. McGrew. 2017. Machine Learning for Encrypted Malware Traffic Classification: Accounting for Noisy Labels and Non-Stationarity. In KDD. ACM, 1723–1732.
[2] Diogo Barradas, Nuno Santos, Luís Rodrigues, Salvatore Signorello, Fernando M. V. Ramos, and André Madeira. 2021. FlowLens: Enabling Efficient Flow Classification for ML-based Network Security Applications. In NDSS.
[3] Markus Bayer, Marc-André Kaufhold, and Christian Reuter. 2022. A Survey on Data Augmentation for Text Classification. ACM Comput. Surv. 55, 7, Article 146 (2022), 39 pages.
[4] Francesco Cerasuolo, Alfredo Nascita, Giampaolo Bovenzi, Giuseppe Aceto, Domenico Cionzio, Antonio Pescapé, and Dario Rossi. 2024. MEMENTO: A novel approach for class incremental learning of encrypted traffic. Comput. Networks 245 (2024), 110374.
[5] Muxi Chen, Zhijian Xu, Ailing Zeng, and Qiang Xu. 2023. FraAug: Frequency Domain Augmentation for Time Series Forecasting. arXiv:2302.09292
[6] Jin Cheng, Yulei Wu, Yuepeng E, Junling You, Tong Li, Hui Li, and Jingguo Ge. 2021. MATEC: A lightweight neural network for online encrypted traffic classification. Computer Networks 199 (2021), 108472.
[7] Kenjiro Cho, Koushrou Mitsuya, and Akira Kato. 2000. Traffic Data Repository at the WIDE Project. In USENIX ATC. USENIX Association.
[8] Andrea Corsini and Shanchieh Jay Yang. 2023. Are Existing Out-Of-Distribution Techniques Suitable for Network Intrusion Detection?. In IEEE CNS. 1–9.
[9] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. In NACCL-HLT. Association for Computational Linguistics, 4171–4186.
[10] Alec F. Diallo and Paul Patras. 2021. Adaptive Clustering-based Malicious Traffic Classification at the Network Edge. In IEEE INFOCOM. IEEE, 1–10.
[11] Yutao Dong, Qing Li, Kaidong Wu, Ruoyu Li, Dan Zhao, Gareth Tyson, Junkun Peng, Yong Jiang, Shutao Xia, and Mingwei Xu. 2023. HorusEye: A Realtime IoT Malicious Traffic Detection Framework using Programmable Switches. In USENIX Security. USENIX Association, 571–588.
[12] R. Doriguzzi-Corin, S. Millar, S. Scott-Hayward, J. Martinez-del Rincón, and D. Siracusa. 2020. Lucid: A Practical, Lightweight Deep Learning Solution for DDoS Attack Detection. IEEE Trans. on Netw. Serv. Manag. 17, 2 (2020), 876–889.
[13] Kevin Fauvel, Fuxing Chen, and Dario Rossi. 2023. A Lightweight, Efficient and Explainable-by-Design Convolutional Neural Network for Internet Traffic Classification. In KDD. ACM, 4013–4023.
[14] Romain Fontugne, Pierre Borgnat, Patrice Abry, and Kensuke Fukuda. 2010. MAWILab: Combining Diverse Anomaly Detectors for Automated Anomaly Labeling and Performance Benchmarking. In ACM CoNEXT. 12 pages.
[15] Canadian Institute for Cybersecurity. 2018. CSE-CIC-IDS2018 dataset. https://registry.opendata.aws/cse-cic-ids2018
[16] Chuanpu Fu, Qi Li, Meng Shen, and Ke Xu. 2021. Realtime Robust Malicious Traffic Detection via Frequency Domain Analysis. In CCS. ACM, 3431–3446.
[17] Chuanpu Fu, Qi Li, and Ke Xu. 2023. Detecting Unknown Encrypted Malicious Traffic in Real Time via Flow Interaction Graph Analysis. In NDSS.
[18] Jingkun Gao, Xiaomian Song, Qingsong Wen, Pichao Wang, Liang Sun, and Huan Xu. 2020. RobustTAD: Robust Time Series Anomaly Detection via Decomposition and Convolutional Neural Networks. In MILeTS. 1–6.
[19] Robert Geirhos, Jörn-Henrik Jacobsen, Claudio Michaelis, Richard S. Zemel, Wieland Brendel, Matthias Bethge, and Felix A. Wichmann. 2020. Shortcut learning in deep neural networks. Nat. Mach. Intell. 2, 11 (2020), 665–673.
[20] Zhong Guan, Gang Xiong, Gaopeng Gou, Zhen Li, Mingxin Cui, and Chang Liu. 2021. BAPM: Block Attention Profiling Model for Multi-tab Website Fingerprinting Attacks on Tor. In ACSAC. ACM, 248–259.
[21] Jorge Luis Guerra, Carlos Catania, and Eduardo Veas. 2022. Datasets are not enough: Challenges in labeling network traffic. Computers & Security 120 (2022), 102810.
[22] Xueying Han, Susu Cui, Song Liu, Chen Zhang, Bo Jiang, and Zhigang Lu. 2023.
Network intrusion detection based on n-gram frequency and time-aware transformer. Comput. Secur. 128 (2023), 103171.
[23] Xueying Han, Song Liu, Junrong Liu, Bo Jiang, Zhigang Lu, and Baoxu Liu. 2024. ECNet: Robust Malicious Network Traffic Detection With Multi-View Feature and Confidence Mechanism. IEEE Trans. Inf. Forensics Secur. 19 (2024), 6871–6885.
[24] Zijun Hang, Yuliang Lu, Yongjie Wang, and Yi Xie. 2023. Flow-MAE: Leveraging Masked AutoEncoder for Accurate, Efficient and Robust Malicious Traffic Classification. In RAID. ACM, 297–314.
[25] Sepp Hochreiter and Jürgen Schmidhuber. 1997. Long Short-Term Memory. Neural Computation 9, 8 (1997), 1735–1780.
[26] Guillermo Iglesias, Edgar Talavera, Ángel González-Prieto, Alberto Mozo, and Sandra Gómez Canaval. 2023. Data Augmentation techniques in time series domain: a survey and taxonomy. Neural Comput. Appl. 35, 14 (2023), 10123–10145.
[27] Minghao Jiang, Mingxin Cui, Chang Liu, Gaopeng Gou, Gang Xiong, and Zhen Li. 2023. Zero-relabeling mobile-app identification over drifted encrypted network traffic. Comput. Networks 228 (2023), 109728.
[28] Zhaoxin Jin, Tianbo Lu, Shuang Luo, and Jiaze Shang. 2023. Transformer-based Model for Multi-tab Website Fingerprinting Attack. In CCS. ACM, 1050–1064.
[29] Gwantae Kim, David K. Han, and Hanseok Ko. 2021. SpecMix : A Mixed Sample Data Augmentation Method for Training with Time-Frequency Domain Features. In INTERSPEECH. ISCA, 546–550.
[30] Y. Lecun, L. Bottou, Y. Bengio, and P. Haffner. 1998. Gradient-based learning applied to document recognition. Proc. IEEE 86, 11 (1998), 2278–2324.
[31] Zhe Li, Josue Ortega Caro, Evgenia Rusak, Wieland Brandt, Matthias Bethge, Fabio Anselmi, Ankit B. Patel, Andreas S. Tolias, and Xaq Pitkow. 2023. Robust deep learning object recognition models rely on low frequency information in natural images. PLoS Comput. Biol. 19, 3 (2023).
[32] Kunda Lin, Xiaolong Xu, and Honghao Gao. 2021. TSCRNN: A novel classification scheme of encrypted traffic based on flow spatiotemporal features for efficient management of IIoT. Comput. Networks 190 (2021), 109774.
[33] Peng Lin, Kejiang Ye, Yishen Hu, Yanying Lin, and Cheng-Zhong Xu. 2023. A Novel Multimodal Deep Learning Framework for Encrypted Traffic Classification. IEEE/ACM Trans. Netw. 31, 3 (2023), 1369–1384.
[34] Xinjie Lin, Gang Xiong, Gaopeng Gou, Zhen Li, Junzheng Shi, and Jing Yu. 2022. ET-BERT: A Contextualized Datagram Representation with Pre-training Transformers for Encrypted Traffic Classification. In Proceedings of the ACM Web Conference 2022. ACM, 633–642.
[35] Chang Liu, Longtao He, Gang Xiong, Zigang Cao, and Zhen Li. 2019. FS-Net: A Flow Sequence Network For Encrypted Traffic Classification. In 2019 IEEE Conference on Computer Communications. IEEE, 1171–1179.
[36] Zhijun Mai, Guosheng Hu, Dexiong Chen, Fumin Shen, and Heng Tao Shen. 2022. MetaMixUp: Learning Adaptive Interpolation Policy of MixUp With Metalearning. IEEE Trans. Neural Networks Learn. Syst. 33, 7 (2022), 3050–3064. doi:10.1109/TN NLS.2020.3049011
[37] Yisroel Mirsky, Tomer Doitshman, Yuval Elovici, and Asaf Shabtai. 2018. Kitsune: An Ensemble of Autoencoders for Online Network Intrusion Detection. In 25th Annual Network and Distributed System Security Symposium. The Internet Society.
[38] Mohammadreza MontazeriShatoori, Logan Davidson, Gurdip Kaur, and Arash Habibi Lashkari. 2020. Detection of DoH Tunnels using Time-series Classification of Encrypted Traffic. In 2020 IEEE Intl Conf on Dependable, Autonomic and Secure Computing, Intl Conf on Pervasive Intelligence and Computing, Intl Conf on Cloud and Big Data Computing, Intl Conf on Cyber Science and Technology Congress (DASC/PiCom/CBDCom/CyberSciTech). 63–70.
[39] Andriy Panchenko, Fabian Lanze, Jan Pennekamp, Thomas Engel, Andreas Zinnen, Martin Henze, and Klaus Wehrle. 2016. Website Fingerprinting at Internet Scale. In 23rd Annual Network and Distributed System Security Symposium. The Internet Society.
[40] Daniel S. Park, William Chan, Yu Zhang, Chung-Cheng Chiu, Barret Zoph, Ekin D. Cubuk, and Quoc V. Le. 2019. SpecAugment: A Simple Data Augmentation Method for Automatic Speech Recognition. In 20th Annual Conference of the International Speech Communication Association. ISCA, 2613–2617.
[41] Yaguan Qian, Wenzhuo Huang, Qinqin Yu, Tengteng Yao, Xiang Ling, Bin Wang, Zhaoquan Gu, and Yanchun Zhang. 2024. Robust filter pruning guided by deep frequency-features for edge intelligence. Neurocomputing 610 (2024), 128586.
[42] Yuqi Qing, Qilei Yin, Xinhao Deng, Yihao Chen, Zhuotao Liu, Kun Sun, Ke Xu, Jia Zhang, and Qi Li. 2024. Low-Quality Training Data Only? A Robust Framework for Detecting Encrypted Malicious Network Traffic. In NDSS.
[43] Nasim Rahaman, Aristide Baratin, Devansh Arpit, Felix Draxler, Min Lin, Fred A. Hamprecht, Yoshua Bengio, and Aaron C. Courville. 2019. On the Spectral Bias of Neural Networks. In ICML, Vol. 97. PMLR, 5301–5310.
[44] levgen Redko, Emilie Morvant, Amaury Habrard, Marc Sebban, and Younès Bennani. 2020. A survey on domain adaptation theory. (2020). arXiv:2004.11829
[45] Leslie Rice, Eric Wong, and J. Zico Kolter. 2020. Overfitting in adversarially robust deep learning. In ICML, Vol. 119. PMLR, 8093–8104.
[46] Iman Sharafaldin, Arash Habibi Lashkari, and Ali A. Ghorbani. 2018. Toward Generating a New Intrusion Detection Dataset and Intrusion Traffic Characterization.
In ICISSP. SciTEpress, 108–116.
[47] Meng Shen, Jinhe Wu, Ke Ye, Ke Xu, Gang Xiong, and Liehuang Zhu. 2025. Robust Detection of Malicious Encrypted Traffic via Contrastive Learning. IEEE Transactions on Information Forensics and Security 20 (2025), 4228–4242.
[48] Payap Sirinam, Mohsen Imani, Marc Juarez, and Matthew Wright. 2018. Deep Fingerprinting: Undermining Website Fingerprinting Defenses with Deep Learning. In CCS. ACM, 1928–1943.
[49] Payap Sirinam, Nate Mathews, Mohammad Saidur Rahman, and Matthew Wright. 2019. Triplet Fingerprinting: More Practical and Portable Website Fingerprinting with N-shot Learning. In CCS. ACM, 1131–1148.
[50] Dong Su, Huan Zhang, Hongge Chen, Jinfeng Yi, Pin-Yu Chen, and Yupeng Gao. 2018. Is Robustness the Cost of Accuracy? - A Comprehensive Study on the Robustness of 18 Deep Image Classification Models. In ECCV, Vol. 11216. Springer, 644–661.
[51] Sunil Thulasidasan, Gopinath Chennupati, Jeff Bilmes, Tannoy Bhattacharya, and Sarah Michalak. 2019. On mixup training: improved calibration and predictive uncertainty for deep neural networks. In NeurIPS, Vol. 32.
[52] Dimitris Tsipras, Shibani Santurkar, Logan Engstrom, Alexander Turner, and Aleksander Madry. 2019. Robustness May Be at Odds with Accuracy. In ICLR.
[53] Aashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkorek, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In NIPS, Vol. 30. Curran Associates Inc.
[54] Tongze Wang, Xiaohui Xie, Wenduo Wang, Chuyi Wang, Youjian Zhao, and Yong Cui. 2024. Netmamba: Efficient Network Traffic Classification Via Pre-Training Unidirectional Mamba. In IEEE ICNP. 1–11.
[55] Xiang Wang, Kai Wang, and Shiguo Lian. 2019. A Survey on Face Data Augmentation. arXiv:1904.11685
[56] Zheng Wu, Yu-ning Dong, Xiaohui Qiu, and Jiong Jin. 2022. Online multimedia traffic classification from the QoS perspective using deep learning. Comput. Networks 204 (2022), 108716.
[57] Renjie Xie, Jiahao Cao, Enhuan Dong, Mingwei Xu, Kun Sun, Qi Li, Licheng Shen, and Menghao Zhang. 2023. Rosetta: Enabling Robust TLS Encrypted Traffic Classification in Diverse Network Environments with TCP-Aware Traffic Augmentation. In USENIX Security. USENIX Association, 625–642.
[58] Jinzhu Yan, Zhuotao Liu, Yuyang Xie, Shiyu Liang, Lin Liu, and Ke Xu. 2025. CertTA: Certified Robustness Made Practical for Learning-Based Traffic Analysis. In USENIX Security. USENIX Association, 7349–7368.
[59] Jingkang Yang, Kaiyang Zhou, Yixuan Li, and Ziwei Liu. 2024. Generalized Out-of-Distribution Detection: A Survey. Int. J. Comput. Vision 132 (2024), 5635–5662.
[60] Sangdoo Yun, Dongyoon Han, Sanghyuk Chun, Seong Joon Oh, Youngjoon Yoo, and Junsuk Choe. 2019. CutMix: Regularization Strategy to Train Strong Classifiers With Localizable Features. In ICCV. IEEE, 6022–6031.
[61] Hongyi Zhang, Moustapha Cissé, Yann N. Dauphin, and David Lopez-Paz. 2018. mixup: Beyond Empirical Risk Minimization. In ICLR.
[62] Linjun Zhang, Zhun Deng, Kenji Kawaguchi, and James Zou. 2022. When and How Mixup Improves Calibration. In ICML, Vol. 162. PMLR, 26135–26160.
A Open Science
Our code is available at https://github.com/Yebmoon/Freqmix_imp roved.
B Ethical Considerations
Our data collection and experimental procedures were conducted with authorization and caused no harm to real-world systems. Therefore, this study raises no ethical concerns.
C Experimental Details
For all the divided datasets, we first extract the packet feature sequence of each session. Following the general practice in traffic classification [57], we uniformly set the length of the extracted packet feature sequences to 100. Sequences shorter than 100 are padded with zeros at the end, while those longer than 100 are truncated. In our experiments, the specific pre-augmentation strategies we adopt are as follows:
-
Packet shift: Randomly select a certain number of positions (determined by the pre-augmentation ratio) and shift the features at these positions forward or backward by at most 2 positions.
-
Packet variation: Randomly select a certain number of positions
Yuhao Yan, Bo Lang, and Xiangyu Li
(determined by the pre-augmentation ratio), compute the standard deviation std of the sequence, and generate a random value r following a normal distribution for each selected position. With a scaling factor of 0.02, we add the final noise, calculated as , to the corresponding positions.
These parameter settings for pre-augmentation are chosen to constrain the augmentation strength within a relatively small range, ensuring that the perturbations do not excessively change the sequence and thus do not violate label consistency. One can adjust the pre-augmentation algorithms to suit different scenarios.
Table 5: Parameter settings for data augmentation methods.
| Method | Parameter Settings |
|---|---|
| Our Method | Pre-augmentation ratio: 0.2Window length w: 10Mixing ratio: beta distribution with parameters (1, 1) |
| Jittering | Noise distribution: Gaussian distribution and scaled by 0.05 times the sequence standard deviation |
| Permutation | Window length: 5 |
| Random Masking | Ratio of masked elements: 0.2 |
| Mixup | Mixing ratio: beta distribution with parameters (1, 1) |
| FreqMix | Mixing ratio: beta distribution with parameters (1, 1) |
| Rosetta | Same as [57] |
When training the models, we set the learning rate to 0.0001 and use the Adam optimizer for optimization. We adopt an early stopping strategy, where training is terminated if the validation loss does not decrease in 20 epochs. For the seven specialized models (DF, BAPM, TMWF, LUCID, Whisper, MATEC, and SmartDetector), all hyperparameters remain the same as those in their original papers (note that we use the supervised version implemented by

Figure 7: Probability density curves of beta distributions with different parameters.
Yan et al. [58] for Whisper), except for adjustments necessitated by the input sequence length being set to 100. The training of SmartDetector consists of a contrastive learning stage and a supervised learning stage. We apply data augmentation during the contrastive learning stage, while no augmentation is performed during the supervised stage. The key parameter settings for each data augmentation method are listed in Table 5. Our method has two main parameters in addition to the pre-augmentation ratio (0.2 means that 20% of the sequence elements are processed with pre-augmentation operations): the Fourier transform window length w and the frequency-domain mixing ratio . Their roles are detailed in Algorithm 1. Since the mixing ratio in Mixup [61] is drawn from a beta distribution, we also apply a beta distribution to the mixing ratio in our method.
D Detailed Results of Our Method's Augmentation Performance on Out-of-Distribution and In-Distribution Data
The detailed results of model performance on out-of-distribution (Section 5.2 and Section 5.3) and in-distribution (Section 5.5) data are presented in Table 6 and Table 7, respectively.
Table 6 shows that after applying our data augmentation method, models exhibit a considerable improvement when handling out-of-distribution samples. In most cases, our method substantially enhances the model's recall while preserving precision, which ultimately leads to an increase in F1 score. This suggests that the model's ability to identify malicious samples has been strengthened. After augmentation, the FPR generally shows a slight increase, which is a side effect of the improved capability to identify malicious samples. Overall, our data augmentation maintains a relatively low false positive rate while significantly improving the recall.
Table 7 shows that in most cases, applying our data augmentation method leads to a decrease in recall and precision on in-distribution data, resulting in a drop in F1 score, and the FPR also increases. However, both the decrease and the increase are usually slight. Moreover, there are several cases where our method actually improves performance on in-distribution data. Since the augmentation significantly improves the model's out-of-distribution generalization ability, we argue that this trade-off is worthwhile.
E Parameter Sensitivity Analysis
To understand the impact of parameters on our method, we conduct a parameter sensitivity analysis on dataset . Two primary parameters influence our method: the frequency-domain mixing ratio and the Fourier transform window length w (see Algorithm 1).
Following the practice of Mixup, the mixing ratio is sampled from a beta distribution, , meaning that the mixing ratio is governed by the parameters of this distribution. For the beta distribution , and are shape parameters that primarily control the shape of the probability density function near and , respectively. Considering the symmetry of mixing, we focus on beta distributions where and are equal. We conduct experiments with sampled from beta distributions with parameters 0.5, 1.0, 2.0, and 8.0. The probability density functions of these beta distributions are visualized in Figure 7. For the distribution

Figure 8: Impact of different parameter values on model performance.
, when , it is a uniform distribution; when , is more likely to be sampled near the endpoints, resulting in a smaller mixing ratio, and the generated data will be closer to the original samples; when , is more likely to be sampled near the center, leading to a larger mixing ratio, and the generated data will be quite different from the original samples; when , compared with , the tendency to sample near the center becomes even more pronounced. A small may generate samples that are easier for the model to learn but might lack sufficient diversity. Conversely, a large may lead to higher diversity but risks producing implausible samples. The experimental results are shown in Figure 8. For the window length , we experiment with values of 5, 10, 20, 50, and 100 (where is equivalent to no windowing), and the results are also shown in Figure 8.
Figure 8 indicates that model performance is relatively stable under moderate parameter settings, while more aggressive settings, such as Beta(8.0, 8.0) or a window length of 100, lead to more noticeable performance fluctuations. There are also cases where a model performs significantly better under a specific parameter setting than under others, likely because the augmented data generated under that setting is more similar to out-of-distribution samples and can be better utilized by the model.
For the beta distribution Beta(), as increases beyond 1.0 (uniform distribution), the generated samples deviate further from the original data. Consequently, several models such as LSTM, 1D-CNN, and LUCID experience substantial drops in F1 score. The impact of on FPR is generally less pronounced, although models like BAPM and TMWF remain sensitive. The FPR of BAPM increases rapidly for larger , while TMWF exhibits relatively high FPR at . Overall, the uniform distribution () provides a good balance between diversity and plausibility of the generated data, and is therefore recommended in our method.
For the window length, a smaller window improves the time-domain resolution but limits the range of frequency components available for mixing. Conversely, a larger window enables more diverse mixing patterns but risks losing some local features. As illustrated in Figure 8, the optimal window length varies across models; however, for most models, a window length of 100 leads to relatively lower F1 scores and higher FPRs, highlighting the importance of windowing. For DF, the F1 score does not peak until
the window length reaches 50. In contrast, 1D-CNN and LUCID experience significant performance degradation once the window length exceeds 10. Interestingly, for 1D-CNN and LUCID, a noticeable rebound in F1-score occurs starting from a window length of 20. This phenomenon may be attributed to the diversity gains from richer mixing patterns beginning to outweigh the performance degradation caused by reduced time-frequency resolution again. For the majority of models, the FPR tends to rise with increasing window length. This likely occurs because larger windows result in coarser granularity of the mixing perturbations, thereby interfering with the model's ability to precisely distinguish malicious samples. A window length of 10 provides a reasonable trade-off between feature granularity and mixing diversity, and is therefore recommended in our method.
Yuhao Yan, Bo Lang, and Xiangyu Li
Table 6: Model performance on out-of-distribution data before and after applying our proposed data augmentation method.
| Model | Metric | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| NoAug | Ours | NoAug | Ours | NoAug | Ours | NoAug | Ours | NoAug | Ours | NoAug | Ours | ||
| LSTM | Recall | 0.5950 | 0.9678 | 0.2406 | 0.8789 | 0.4081 | 0.6987 | 0 | 0 | 0.8566 | 0.8297 | 0.7148 | 0.7149 |
| Precision | 0.9889 | 0.9382 | 0.9814 | 0.9611 | 0.9990 | 0.9776 | 0 | 0 | 0.6923 | 0.7142 | 0.7887 | 0.8166 | |
| F1 | 0.7429 | 0.9528 | 0.3865 | 0.9182 | 0.5794 | 0.8149 | 0 | 0 | 0.7657 | 0.7677 | 0.7499 | 0.7623 | |
| FPR | 0.0018 | 0.0171 | 0.0006 | 0.0045 | 0.0001 | 0.0035 | – | – | 0.1831 | 0.1597 | 0.1574 | 0.1320 | |
| 1D-CNN | Recall | 0.5904 | 0.7558 | 0.4548 | 0.7032 | 0.7082 | 0.9683 | 0.0060 | 0.4337 | 0.5448 | 0.5990 | 0.5891 | 0.6291 |
| Precision | 0.9658 | 0.8499 | 0.9022 | 0.6101 | 0.9744 | 0.8947 | 0.0556 | 0.8372 | 0.5978 | 0.5331 | 0.6635 | 0.6110 | |
| F1 | 0.7328 | 0.8001 | 0.6047 | 0.6533 | 0.8202 | 0.9301 | 0.0109 | 0.5714 | 0.5701 | 0.5641 | 0.6240 | 0.6199 | |
| FPR | 0.0056 | 0.0358 | 0.0063 | 0.0571 | 0.0041 | 0.0253 | 0.0013 | 0.0011 | 0.1763 | 0.2523 | 0.2457 | 0.3293 | |
| Transformer | Recall | 0.6011 | 0.8821 | 0.4102 | 0.9159 | 0.5485 | 0.6479 | 0 | 0.4337 | 0.7517 | 0.8231 | 0.6125 | 0.6730 |
| Precision | 0.9643 | 0.9215 | 0.9298 | 0.9129 | 0.9900 | 0.9856 | 0 | 0.3380 | 0.6520 | 0.6510 | 0.7591 | 0.7353 | |
| F1 | 0.7405 | 0.9014 | 0.5692 | 0.9144 | 0.7059 | 0.7818 | 0 | 0.3799 | 0.6983 | 0.7270 | 0.6780 | 0.7027 | |
| FPR | 0.0060 | 0.0201 | 0.0039 | 0.0111 | 0.0012 | 0.0021 | – | 0.0108 | 0.1929 | 0.2122 | 0.1599 | 0.1992 | |
| DF | Recall | 0.5798 | 0.7148 | 0.5928 | 0.7770 | 0.4689 | 0.5674 | 0 | 0.3675 | 0.7532 | 0.7967 | 0.7031 | 0.7014 |
| Precision | 0.9346 | 0.9644 | 0.9643 | 0.9252 | 0.9972 | 0.9947 | 0 | 0.0483 | 0.6649 | 0.6886 | 0.8034 | 0.8111 | |
| F1 | 0.7156 | 0.8210 | 0.7342 | 0.8446 | 0.6379 | 0.7226 | 0 | 0.0854 | 0.7063 | 0.7387 | 0.7499 | 0.7523 | |
| FPR | 0.0109 | 0.0071 | 0.0028 | 0.0080 | 0.0003 | 0.0007 | – | 0.0919 | 0.1825 | 0.1733 | 0.1415 | 0.1343 | |
| BAPM | Recall | 0.5623 | 0.8167 | 0.4233 | 0.7693 | 0.5130 | 0.7571 | 0.3675 | 0.8012 | 0.7626 | 0.7506 | 0.6768 | 0.7016 |
| Precision | 0.9475 | 0.8158 | 0.9128 | 0.6513 | 0.9927 | 0.8759 | 0.0857 | 0.2519 | 0.6050 | 0.6352 | 0.7701 | 0.7575 | |
| F1 | 0.7058 | 0.8163 | 0.5783 | 0.7054 | 0.6764 | 0.8121 | 0.1390 | 0.3833 | 0.6747 | 0.6881 | 0.7204 | 0.7285 | |
| FPR | 0.0084 | 0.0495 | 0.0051 | 0.0523 | 0.0008 | 0.0238 | 0.0498 | 0.0302 | 0.2394 | 0.2073 | 0.1662 | 0.1846 | |
| TMWF | Recall | 0.7558 | 0.8793 | 0.6239 | 0.7394 | 0.5176 | 0.5990 | 0 | 0.8072 | 0.7964 | 0.7991 | 0.6683 | 0.6871 |
| Precision | 0.9261 | 0.9341 | 0.9778 | 0.9634 | 0.9972 | 0.9898 | 0 | 0.3583 | 0.6725 | 0.6752 | 0.7985 | 0.8001 | |
| F1 | 0.8323 | 0.9059 | 0.7617 | 0.8366 | 0.6815 | 0.7463 | 0 | 0.4963 | 0.7292 | 0.7320 | 0.7276 | 0.7393 | |
| FPR | 0.0162 | 0.0166 | 0.0018 | 0.0036 | 0.0003 | 0.0014 | – | 0.0183 | 0.1866 | 0.1848 | 0.1387 | 0.1412 | |
| LUCID | Recall | 0.1975 | 0.2764 | 0.1918 | 0.2546 | 0.6951 | 0.7299 | 0 | 0 | 0 | 0 | 0.2414 | 0.2219 |
| Precision | 0.9110 | 0.9531 | 0.8133 | 0.9033 | 0.9138 | 0.9471 | 0 | 0 | 0 | 0 | 0.7021 | 0.7067 | |
| F1 | 0.3247 | 0.4285 | 0.3104 | 0.3973 | 0.7896 | 0.8245 | 0 | 0 | 0 | 0 | 0.3593 | 0.3378 | |
| FPR | 0.0116 | 0.0082 | 0.0150 | 0.0093 | 0.0115 | 0.0071 | – | – | – | – | 0.0496 | 0.0446 | |
| Whisper | Recall | 0.5678 | 0.7104 | 0.6121 | 0.6784 | 0.7105 | 0.9659 | 0 | 0 | 0.6061 | 0.6403 | 0.1762 | 0.5108 |
| Precision | 0.9879 | 0.9758 | 0.9859 | 0.9655 | 0.9618 | 0.8561 | 0 | 0 | 0.3350 | 0.3904 | 0.4610 | 0.8349 | |
| F1 | 0.7211 | 0.8222 | 0.7553 | 0.7969 | 0.8173 | 0.9077 | 0 | 0 | 0.4315 | 0.4850 | 0.2550 | 0.6338 | |
| FPR | 0.0043 | 0.0109 | 0.0031 | 0.0086 | 0.0042 | 0.0240 | – | – | 0.2024 | 0.1682 | 0.1052 | 0.0516 | |
| MATEC | Recall | 0.2059 | 0.8987 | 0.0796 | 0.9548 | 0.8076 | 0.8861 | 0.2169 | 0.4337 | 0.8076 | 0.8083 | 0.6604 | 0.6639 |
| Precision | 0.5354 | 0.7731 | 0.9490 | 0.9958 | 0.9933 | 0.9961 | 0.7826 | 0.6486 | 0.6215 | 0.6567 | 0.7105 | 0.7090 | |
| F1 | 0.2974 | 0.8312 | 0.1469 | 0.9748 | 0.8909 | 0.9379 | 0.3396 | 0.5199 | 0.7024 | 0.7247 | 0.6845 | 0.6857 | |
| FPR | 0.1108 | 0.1635 | 0.0015 | 0.0014 | 0.0008 | 0.0005 | 0.0008 | 0.0030 | 0.2365 | 0.2032 | 0.2213 | 0.2241 | |
| SmartDetector | Recall | 0.9897 | 0.9994 | 0.9955 | 0.9999 | 0.9998 | 0.9999 | 0 | 0.4337 | 0.6217 | 0.6951 | 0.7425 | 0.8225 |
| Precision | 0.9973 | 0.9990 | 1 | 1 | 0.9989 | 0.9992 | 0 | 0.4186 | 0.2811 | 0.3630 | 0.8072 | 0.8090 | |
| F1 | 0.9935 | 0.9992 | 0.9977 | 0.9999 | 0.9994 | 0.9996 | 0 | 0.4260 | 0.3871 | 0.4769 | 0.7735 | 0.8157 | |
| FPR | 0.0017 | 0.0006 | 0 | 0 | 0.0002 | 0.0001 | – | 0.0076 | 0.2675 | 0.2052 | 0.0906 | 0.0991 | |
- NoAug: No augmentation.
** The best results are marked in bold. We mark the FPR as “–” when the F1 score is 0 (as FPR is meaningless in this case).
Table 7: Model performance on in-distribution data before and after applying our proposed data augmentation method.
| Model | Metric | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| NoAug | Ours | NoAug | Ours | NoAug | Ours | NoAug | Ours | NoAug | Ours | NoAug | Ours | ||
| LSTM | Recall | 0.9975 | 0.9939 | 0.9984 | 0.9973 | 0.9978 | 0.9798 | 0.7654 | 0.5309 | 0.9213 | 0.9052 | 0.8985 | 0.8973 |
| Precision | 0.9989 | 0.9806 | 0.9993 | 0.9956 | 0.9981 | 0.9784 | 0.9254 | 0.6232 | 0.9214 | 0.9376 | 0.9035 | 0.9207 | |
| F1 | 0.9982 | 0.9872 | 0.9988 | 0.9965 | 0.9980 | 0.9791 | 0.8378 | 0.5733 | 0.9214 | 0.9211 | 0.9010 | 0.9088 | |
| FPR | 0.0002 | 0.0037 | 0.0003 | 0.0017 | 0.0003 | 0.0037 | 0.0020 | 0.0105 | 0.0792 | 0.0607 | 0.0690 | 0.0556 | |
| 1D-CNN | Recall | 0.9811 | 0.9780 | 0.9836 | 0.9863 | 0.9424 | 0.8560 | 0.3333 | 0.1852 | 0.6442 | 0.6678 | 0.6962 | 0.6953 |
| Precision | 0.9847 | 0.8860 | 0.9861 | 0.9180 | 0.9714 | 0.8687 | 0.8438 | 0.9375 | 0.7946 | 0.7318 | 0.7827 | 0.7188 | |
| F1 | 0.9829 | 0.9297 | 0.9849 | 0.9509 | 0.9567 | 0.8623 | 0.4779 | 0.3093 | 0.7115 | 0.6983 | 0.7370 | 0.7069 | |
| FPR | 0.0029 | 0.0238 | 0.0054 | 0.0341 | 0.0048 | 0.0223 | 0.0020 | 0.0004 | 0.1678 | 0.2467 | 0.1389 | 0.1955 | |
| Transformer | Recall | 0.9931 | 0.9932 | 0.9928 | 0.9980 | 0.9921 | 0.9912 | 0.6420 | 0.5432 | 0.8480 | 0.8941 | 0.7903 | 0.8527 |
| Precision | 0.9933 | 0.9727 | 0.9963 | 0.9860 | 0.9901 | 0.9845 | 0.7879 | 0.9565 | 0.8867 | 0.8905 | 0.8794 | 0.8653 | |
| F1 | 0.9932 | 0.9828 | 0.9946 | 0.9920 | 0.9911 | 0.9879 | 0.7075 | 0.6929 | 0.8670 | 0.8923 | 0.8325 | 0.8590 | |
| FPR | 0.0013 | 0.0053 | 0.0014 | 0.0055 | 0.0017 | 0.0027 | 0.0056 | 0.0008 | 0.1092 | 0.1108 | 0.0779 | 0.0954 | |
| DF | Recall | 0.9969 | 0.9913 | 0.9977 | 0.9936 | 0.9950 | 0.9814 | 0.6914 | 0.5556 | 0.8660 | 0.8800 | 0.8568 | 0.8839 |
| Precision | 0.9967 | 0.9883 | 0.9980 | 0.9863 | 0.9978 | 0.9963 | 0.9655 | 0.9184 | 0.8959 | 0.8924 | 0.9135 | 0.9167 | |
| F1 | 0.9968 | 0.9898 | 0.9979 | 0.9899 | 0.9964 | 0.9888 | 0.8058 | 0.6923 | 0.8807 | 0.8862 | 0.8843 | 0.9000 | |
| FPR | 0.0006 | 0.0022 | 0.0008 | 0.0054 | 0.0004 | 0.0006 | 0.0008 | 0.0016 | 0.1015 | 0.1070 | 0.0583 | 0.0578 | |
| BAPM | Recall | 0.9937 | 0.9932 | 0.9974 | 0.9935 | 0.9935 | 0.9856 | 0.7407 | 0.5432 | 0.8475 | 0.8304 | 0.8220 | 0.8185 |
| Precision | 0.9955 | 0.9301 | 0.9948 | 0.9249 | 0.9938 | 0.8637 | 0.7792 | 0.7458 | 0.8539 | 0.8711 | 0.8773 | 0.8799 | |
| F1 | 0.9946 | 0.9606 | 0.9961 | 0.9580 | 0.9937 | 0.9206 | 0.7595 | 0.6286 | 0.8507 | 0.8503 | 0.8487 | 0.8481 | |
| FPR | 0.0009 | 0.0141 | 0.0020 | 0.0312 | 0.0011 | 0.0268 | 0.0068 | 0.0060 | 0.1462 | 0.1238 | 0.0826 | 0.0803 | |
| TMWF | Recall | 0.9980 | 0.9937 | 0.9974 | 0.9933 | 0.9942 | 0.9670 | 0.7901 | 0.5185 | 0.8918 | 0.8798 | 0.8645 | 0.8757 |
| Precision | 0.9944 | 0.9625 | 0.9990 | 0.9951 | 0.9973 | 0.9902 | 0.8205 | 0.7778 | 0.8935 | 0.9022 | 0.9080 | 0.9124 | |
| F1 | 0.9962 | 0.9779 | 0.9982 | 0.9942 | 0.9957 | 0.9785 | 0.8050 | 0.6222 | 0.8926 | 0.8909 | 0.8857 | 0.8937 | |
| FPR | 0.0011 | 0.0073 | 0.0004 | 0.0019 | 0.0005 | 0.0016 | 0.0056 | 0.0048 | 0.1072 | 0.0961 | 0.0630 | 0.0604 | |
| LUCID | Recall | 0.8421 | 0.8360 | 0.9641 | 0.8651 | 0.9420 | 0.9404 | 0 | 0 | 0 | 0 | 0.3647 | 0.3529 |
| Precision | 0.9372 | 0.9454 | 0.9296 | 0.9481 | 0.9680 | 0.9825 | 0 | 0 | 0 | 0 | 0.7029 | 0.6957 | |
| F1 | 0.8871 | 0.8873 | 0.9465 | 0.9047 | 0.9548 | 0.9610 | 0 | 0 | 0 | 0 | 0.4803 | 0.4683 | |
| FPR | 0.0048 | 0.0041 | 0.0150 | 0.0097 | 0.0123 | 0.0066 | - | - | - | - | 0.0336 | 0.0337 | |
| Whisper | Recall | 0.9879 | 0.9800 | 0.9933 | 0.9821 | 0.9922 | 0.9927 | 0 | 0 | 0.8572 | 0.8411 | 0.0888 | 0.6236 |
| Precision | 0.9924 | 0.9482 | 0.9914 | 0.9612 | 0.9955 | 0.9690 | 0 | 0 | 0.8368 | 0.8507 | 0.5300 | 0.9006 | |
| F1 | 0.9902 | 0.9638 | 0.9924 | 0.9715 | 0.9939 | 0.9807 | 0 | 0 | 0.8469 | 0.8459 | 0.1521 | 0.7369 | |
| FPR | 0.0006 | 0.0046 | 0.0018 | 0.0081 | 0.0019 | 0.0133 | - | - | 0.1794 | 0.1584 | 0.0360 | 0.0315 | |
| MATEC | Recall | 0.9905 | 0.9951 | 0.9932 | 0.9962 | 0.9946 | 0.9963 | 0.6790 | 0.7654 | 0.8931 | 0.8923 | 0.8481 | 0.8739 |
| Precision | 0.9961 | 0.9983 | 0.9972 | 0.9980 | 0.9984 | 0.9989 | 0.8871 | 0.8986 | 0.8792 | 0.9004 | 0.8653 | 0.8825 | |
| F1 | 0.9933 | 0.9967 | 0.9952 | 0.9971 | 0.9965 | 0.9976 | 0.7692 | 0.8267 | 0.8861 | 0.8963 | 0.8566 | 0.8782 | |
| FPR | 0.0003 | 0.0001 | 0.0006 | 0.0004 | 0.0006 | 0.0005 | 0.0028 | 0.0028 | 0.1237 | 0.0995 | 0.0949 | 0.0836 | |
| SmartDetector | Recall | 0.9989 | 0.9999 | 0.9999 | 1 | 1 | 1 | 0.6667 | 0.7160 | 0.8423 | 0.8906 | 0.8717 | 0.9033 |
| Precision | 0.9990 | 0.9999 | 0.9999 | 0.9997 | 0.9997 | 0.9999 | 0.8308 | 0.9355 | 0.8763 | 0.8795 | 0.9254 | 0.9344 | |
| F1 | 0.9990 | 0.9999 | 0.9999 | 0.9999 | 0.9998 | 0.9999 | 0.7397 | 0.8112 | 0.8589 | 0.8850 | 0.8978 | 0.9186 | |
| FPR | 0.0001 | 0 | 0 | 0.0001 | 0.0001 | 0 | 0.0044 | 0.0016 | 0.1276 | 0.1309 | 0.0321 | 0.0290 | |
- NoAug: No augmentation.
** The best results are marked in bold. We mark the FPR as “–” when the F1 score is 0 (as FPR is meaningless in this case).