Manuscript Offprint
arXiv:2611.12442When Handshakes Go Dark: An Adaptive Semantic-Sequential Fusion Framework for Encrypted Traffic Classification
ARTICLE INFO
Keywords:
Encrypted traffic classification
Self-supervised pre-training
Protocol-aware representation learning
Adaptive representation fusion
Constrained observability
ABSTRACT
Encrypted traffic classification is essential for network security monitoring and traffic management. Self-supervised pre-training provides a promising approach to learning reusable representations from large-scale unlabeled traffic data. However, encrypted communication protocols such as TLS 1.3 and QUIC protect increasing portions of application and handshake data, while privacy-enhancing mechanisms such as Encrypted Client Hello (ECH) further conceal service-identifying metadata. Consequently, observable upper-layer bytes are increasingly dominated by ciphertext, weakening the correspondence between raw-byte patterns and application semantics. Raw-byte-based models therefore struggle to learn generalizable, semantically meaningful representations from strongly encrypted traffic. Moreover, the availability and discriminative value of observable information vary across protocols, protection profiles, and classification tasks, making it difficult to maintain effective classification across diverse traffic scenarios. To address these challenges, we propose FLARE, a Field-aware Learning and Adaptive Representation Fusion framework for Encrypted Traffic Classification. FLARE pre-trains a BERT-based packet encoder using Masked Field Prediction to reconstruct masked tokens from field-structured context. During downstream fine-tuning, the parameters of the pre-trained packet encoder remain frozen, and a packet-level gated fusion module adaptively combines protocol-semantic representations with directional packet-length representations, while a flow-level encoder models inter-packet dependencies for classification. We evaluate FLARE on eight datasets covering diverse encrypted-traffic classification tasks, including CipherSpectrum and VisQUIC datasets, which represent strongly encrypted traffic scenarios. FLARE achieves superior performance over baselines across the evaluated datasets. Notably, it outperforms the strongest pre-trained baseline by 10.92% on the QUIC-based website fingerprinting task, highlighting the effectiveness of field-aware pre-training and adaptive semantic-sequential fusion under constrained observability.
handshake information. This shift substantially constrains the information available for traffic classification and challenges methods that rely on plaintext content or high-level handshake features.
Early traffic classifiers typically combine manually engineered flow-level statistics with conventional machine-learning models. Representative methods such as AppScanner and BIND use features including packet and byte counts, flow duration, and inter-arrival times [10, 11]. Although compact, these representations depend on domain expertise and handcrafted feature engineering.
Deep-learning methods subsequently reduced this dependence by learning representations directly from traffic data. DeepPacket, for example, learns from raw byte sequences [12]. FS-Net captures communication behavior from packet-length and packet-direction sequences [13], and Deep Fingerprinting uses packet-direction sequences [14]. These sequence features remain passively observable even when application-layer payloads are encrypted, and preserve useful discriminative information. However, these methods generally require substantial labeled traffic, limiting their adaptability to new applications, protocols, and network environments.
Pre-training offers a promising paradigm for reducing label dependency through self-supervised learning on large volumes of unlabeled traffic. Existing studies have explored
*Corresponding author
Tong Guan et al.: Preprint submitted to Elsevier
Page 1 of 19
Table 1 Observability of application-layer information, protocol-layer metadata, and behavioral metadata across representative protection profiles.
| Information Category | Representative Information | Plain HTTP | TLS 1.2 | TLS 1.3 | TLS 1.3 + ECH | QUIC |
|---|---|---|---|---|---|---|
| Application-Layer Information | HTTP Request semantics and headers: method, target, authority, and other header fields | ● | ○ | ○ | ○ | ○ |
| Application payload | ● | ○ | ○ | ○ | ○ | |
| Protocol-Semantic Metadata | Network-layer fields: version, header length, DSCP/ECN, total length, fragmentation, TTL/hop limit, next protocol, and addresses | ● | ● | ● | ● | ● |
| TCP header fields: ports, header length, control flags, sequence and acknowledgment numbers, window size, checksum, and options | ● | ● | ● | ● | — | |
| UDP header fields: ports, datagram length, and checksum | — | — | — | — | ● | |
| TLS record-layer framing: record boundaries, outer record header, and ciphertext length | — | ● | ○1 | ○1 | — | |
| ClientHello fields: SNI, ALPN, supported versions, cipher suites, and extensions | — | ● | ● | ○2 | ◇3 | |
| Server certificate and authentication-related handshake messages | — | ●4 | ○ | ○ | ○ | |
| QUIC wire-image fields: header form, version, and packet type in long headers, connection IDs, long-header length, and selected public bits | — | — | — | — | ○5 | |
| Behavioral Metadata | Packet length, direction, observed order and timing | ● | ● | ● | ● | ● |
Profiles: Plain HTTP denotes HTTP/1.1 over TCP; the TLS columns denote HTTP over TLS/TCP; and QUIC denotes HTTP/3 over QUIC without ECH.
Symbols: ● directly observable and parseable; ○ partially observable or limited to outer framing/metadata; ◇ recoverable from publicly derivable keys or protocol information; ○ cryptographically protected from a passive observer; and — corresponding protocol element not present.
¹ TLS 1.3 exposes outer record framing and ciphertext length, while the inner content type and post-ServerHello messages are encrypted.
² ECH encrypts the true SNI and other sensitive ClientHello parameters; ClientHelloOuter remains visible and may expose public parameters.
³ QUIC Initial contents are recoverable using publicly derivable keys; later encryption levels remain protected.
⁴ Assumes a full certificate-based TLS 1.2 handshake without session resumption; post-ChangeCipherSpec messages remain protected.
⁵ QUIC long headers expose the version, packet type, connection IDs, and the Length field; short headers expose less, while packet numbers and selected header bits are protected.
representations at the byte, packet, burst, and flow levels. ET-BERT adopts masked prediction over byte tokens [15], Flow-MAE learns traffic representations through masked reconstruction [16], NetGPT introduces generative traffic pre-training [17], and TrafficFormer further models inter-packet sequential relationships [18].
Despite recent progress, traffic classification under strong encryption still faces two key challenges. First, modern protection mechanisms substantially reduce and reshape the observable features. As summarized in Table 1, application content and service-identifying handshake metadata become increasingly unavailable. Under such constrained observability, the correspondence between observable byte patterns and application semantics is substantially weakened, making it difficult to extract semantically meaningful and discriminative representations from ciphertext-dominated traffic bytes. Second, the availability and discriminative value of observable information vary across protocols, encryption profiles, and downstream classification tasks. Such variation arises even within a single connection, where handshake records expose parsable protocol fields but subsequent encrypted records do not. This variation makes it difficult
to maintain effective classification across diverse traffic scenarios. These challenges motivate an approach that learns informative representations from the information that remains observable under encryption and integrates these representations adaptively at the packet level.
To address these limitations, we propose FLARE, a Field-aware Learning and Adaptive Representation fusion framework for Encrypted traffic classification. At the packet level, FLARE parses packets into protocol fields, constructs field-aligned token sequences, and pre-trains a BERT-based encoder using a Masked Field Prediction (MFP) task. MFP masks selected tokens in the field-structured packet sequence and reconstructs them from the surrounding protocol context. Rather than treating all byte positions uniformly, the objective uses protocol-defined field organization to guide representation learning, encouraging the encoder to capture field-aware contextual dependencies. During downstream fine-tuning, the pre-trained encoder, referred to as PacketEncoder, is frozen; that is, its pre-trained parameters are not updated during task-specific fine-tuning and remain unchanged at inference. The frozen PacketEncoder produces protocol-semantic representations for individual packets. A gated fusion module combines each representation with
Tong Guan et al.: Preprint submitted to Elsevier
Page 2 of 19 its corresponding directional packet-length representation, and a flow-level encoder models the resulting sequence for task-specific classification. This separation allows reusable packet-level protocol knowledge to be adapted to different downstream tasks.
The main contributions are summarized as follows:
-
Field-aware packet-level pre-training. We construct packet-level inputs by parsing protocol fields across the network, transport, and encryption-protocol layers, including the TLS record and QUIC headers, while excluding identity-related fields and retaining only a short payload prefix. We pre-train a packet encoder with Masked Field Prediction, which aligns the prediction targets and their context with protocol fields, so that the encoder learns field values, inter-field dependencies, and packet structure that remain observable under encryption. The pre-trained encoder is then frozen and reused across downstream tasks.
-
Fine-grained adaptive semantic-sequential fusion. Since the observable information varies across tasks and even between packets of the same connection, FLARE introduces a packet-level, feature-wise gating mechanism conditioned on both the protocol-semantic and directional packet-length representations of each packet. The gate dynamically recalibrates the contribution of each representation at the level of individual feature dimensions, allowing the fusion to adapt to the observability of each packet.
-
Extensive evaluation across diverse encryption scenarios. We evaluate FLARE on eight datasets covering application classification, malicious traffic detection, website fingerprinting, and encrypted network service classification tasks. The evaluation includes CipherSpectrum [19] and VisQUIC [20], which represent strongly encrypted traffic scenarios where the observability of application content and service-identifying handshake metadata is substantially restricted. FLARE achieves superior performance over a diverse set of baselines, with particularly pronounced gains under constrained observability.
The source code and pre-trained models of FLARE are publicly available at https://github.com/sunshine12160110/FLARE.
2. Related Work
2.1. Traditional Machine Learning-Based Traffic Classification
As port-based and payload-inspection rules were rendered ineffective by encryption and port obfuscation, early studies relied on manually engineered flow statistics and traffic fingerprints combined with conventional machine-learning classifiers. AppScanner extracts statistical features
from packet length and timing patterns for mobile application identification, while BIND constructs bidirectional flow representations for traffic classification [10, 11]. CUMUL constructs traffic fingerprints from encrypted website traces and uses them for website fingerprinting [21].
These approaches demonstrate that useful traffic characteristics can be derived without decrypting application content. However, their effectiveness depends heavily on domain knowledge and handcrafted feature engineering. Moreover, the distributions of engineered statistics and fingerprints may vary with network conditions, capture environments, application behavior, and traffic composition, making it difficult to design a fixed handcrafted feature set that remains effective across diverse traffic scenarios.
2.2. Deep Learning-Based Traffic Classification
Deep learning [12–14, 22–25] substantially reduced the reliance on manual feature engineering by learning traffic representations directly from traffic data. One line of research operates on raw byte sequences. DeepPacket employs convolutional and autoencoder-based architectures to learn end-to-end representations from packet bytes [12]. Such methods can discover discriminative byte-level patterns automatically. However, as modern protocols encrypt increasing portions of upper-layer content, the correspondence between observable byte patterns and application semantics becomes progressively weaker.
Another line of research models communication behavior that remains observable without payload decryption. FS-Net learns flow representations from packet-length and packet-direction sequences, while Deep Fingerprinting models direction-aware packet sequences for website fingerprinting [13, 14]. LEXNet further develops lightweight sequence modeling for encrypted traffic classification [24]. Graph-based approaches such as GraphDApp organize packet interactions into structured representations to capture relational characteristics within traffic sessions [25]. These studies demonstrate the effectiveness of raw-byte, behavioral, and relational representations for encrypted traffic analysis. Packet-length, direction, and timing sequences remain passively observable under encryption, although their distributions may be affected by network conditions.
Nevertheless, most of these models are trained for specific tasks and require substantial labeled traffic, limiting their adaptation to emerging applications, protocols, and deployment environments.
2.3. Pre-training-Based Traffic Classification
Self-supervised pre-training enables traffic models to learn reusable representations from large volumes of unlabeled data before adapting to downstream tasks. Existing approaches have explored diverse backbone architectures, traffic representations, and pre-training objectives.
Transformer-based methods [15, 18, 26–31] constitute a major line of traffic pre-training research. ET-BERT tokenizes bidirectional traffic bursts and employs traffic-specific
Tong Guan et al.: Preprint submitted to Elsevier
Page 3 of 19 masked and contextual prediction tasks to learn contextualized datagram representations [15]. TrafficFormer further incorporates fine-grained traffic objectives and inter-packet order and direction relationships into Transformer-based pre-training [18]. MIETT treats packets as separate instances within a flow and uses two-level attention to capture both token-level and packet-level relationships. Its Packet Relative Position Prediction and Flow Contrastive Learning objectives further model temporal and flow-level structures [30].
Another major line of methods formulates traffic pre-training as masked autoencoding. YaTC converts raw flows into formatted matrices containing multi-level flow information and employs packet-level and flow-level attention within a masked autoencoder framework [32]. Flow-MAE represents traffic bursts as patch sequences and reconstructs masked regions to learn compact representations for malicious traffic classification [16]. These approaches demonstrate that matrix-based and patch-based representations can preserve hierarchical traffic information while enabling efficient masked reconstruction.
Generative and efficient architectures have also been introduced into traffic pre-training. NetGPT formulates traffic understanding and generation within a unified generative pre-training framework using multi-pattern traffic representations [17]. NetMamba and PaT replace quadratic-complexity self-attention with linear-time state-space modeling and develop traffic representations for efficient long-sequence processing [33, 34]. These studies extend traffic pre-training beyond encoder-only Transformers and explore broader trade-offs among representation capacity, efficiency, and downstream adaptability.
Recent studies have further extended traffic pre-training to multi-granularity and multimodal representations. MLETC jointly learns representations at the byte, field, and packet levels, with field-level learning applied to the IP and TCP/UDP headers [35]. MM4flow separately pre-trains representations of the payload bytes and the packet-length sequence and integrates them through cross-modal fusion during downstream fine-tuning [31]. These studies integrate traffic information at multiple granularities or from multiple modalities to enrich traffic representations.
However, modern encryption protocols continue to restrict and reshape the information available to passive traffic classifiers. TLS 1.3 and QUIC encrypt or conceal an increasing proportion of application-layer content and handshake metadata, while protocol header fields and packet length and direction remain largely observable. The availability and discriminative value of the remaining observable features vary across traffic scenarios and downstream tasks. Learning informative and reusable traffic representations under such constrained and variable observability therefore remains an open challenge.
3. Methodology
As summarized in Table 1, the observability of application-layer information, protocol-semantic metadata, and behavioral metadata varies across protection profiles. Motivated by this observation, FLARE learns parsable protocol information and observable behavioral metadata through separate representation pathways and then adaptively fuses the resulting representations for downstream classification. The overall architecture of FLARE is illustrated in Figure 1. It comprises three stages: packet-level protocol learning, feature extraction and adaptive fusion, and flow-level fine-tuning.
Packet-level Protocol Learning. FLARE parses each packet into structured protocol fields and divides the remaining unstructured bytes into fixed-size units. A BERT-based packet encoder is then pre-trained using Masked Field Prediction (MFP) to learn field-aware packet representations from unlabeled traffic.
Feature Extraction and Adaptive Fusion. The pre-trained packet encoder is frozen to extract a protocol-semantic representation for each packet. In parallel, packet length and direction are combined into a directional packet-length feature. A gated fusion module adaptively integrates the semantic and sequential representations.
Flow-level Fine-tuning. During downstream fine-tuning, the packet-level encoder remains frozen, while the gated fusion module, flow-level encoder, and task-specific classifier are jointly optimized using labeled data. The flow-level encoder captures inter-packet dependencies and produces a task-specific flow representation for classification.
3.1. Packet-level Protocol Learning
As detailed in §3.1.1 and §3.1.2, each packet header is parsed into structured protocol fields and tokenized using field-aligned units. A BERT-based encoder, referred to as PacketEncoder, is pre-trained using the Masked Field Prediction (MFP) objective. This design encourages the encoder to capture field-aware protocol semantics and contextual dependencies among protocol fields and packet content, providing a structured semantic representation for subsequent flow-level modeling.
3.1.1. Field Parsing
In this paper, we use the term protocol semantics to refer to the meanings that protocol specifications assign to header and control fields, such as the IP and TCP/UDP header fields, the TLS record and handshake headers, and the public QUIC header fields, together with the dependencies among them. Content carried in the payload, such as application data, is not regarded as protocol semantics. As shown in Table 1, although stronger protection increasingly conceals application-layer content and service-identifying handshake metadata, these header fields remain largely observable and parsable, so protocol semantics remain available even under TLS 1.3 and QUIC. We therefore use Scapy [36] to dissect each packet into its constituent fields across the supported
Tong Guan et al.: Preprint submitted to Elsevier
Page 4 of 19

Figure 1: The overview of FLARE. The framework comprises packet-level protocol learning through field-aware masked prediction, extraction and adaptive fusion of reusable protocol-semantic representations and directional packet-length sequence, and flow-level fine-tuning for diverse traffic classification tasks.
protocol layers. Each parsed field is treated as a semantic unit, allowing the tokenization process to retain field boundaries and the ordered structure of the parsed protocol elements.
During parsing, identity-related fields, including IP addresses, port numbers, and Server Name Indication (SNI), are excluded to prevent the model from exploiting endpoint-specific or service-specific shortcuts.
For each packet, we retain at most the first bytes for field parsing and tokenization, where is set to 80 by default. This byte budget typically covers the network-layer and transport-layer headers, parsable protocol information near the beginning of the packet, and a limited portion of the payload. Retaining a limited payload prefix allows the encoder to exploit application-level information when they remain observable in plaintext or partially protected traffic, while reducing the risk of excessive reliance on payload content. Bytes within the retained prefix that cannot be parsed as structured protocol fields, such as encrypted payload bytes, are divided into fixed-size 2-byte units.
After field extraction and byte segmentation, the resulting units are organized into a unified vocabulary using Byte Pair Encoding (BPE). The BPE vocabulary is learned from protocol-field values and segmented byte units by iteratively merging frequently occurring adjacent byte pairs. This process produces compact token units that reflect local byte-level regularities in both protocol-field values and the remaining packet bytes.
Following standard masked language modeling conventions, four special tokens are introduced. A [CLS] token is prepended to each sequence, and its final hidden state is used as the aggregate packet representation. A [MASK] token designates positions selected for the MFP task. A [PAD] token is used to align sequences to a fixed length, and an
[UNK] token represents values that are not covered by the learned vocabulary.
3.1.2. Masked Field Prediction
We instantiate PacketEncoder and pre-train it on unlabeled traffic using the Masked Field Prediction (MFP) task. Its input is the field-structured packet sequence produced by §3.1.1.
Formally, given the token sequence of a packet , we randomly select 15% of token positions for prediction. For each selected position, the original token is replaced with [MASK], replaced with a randomly sampled vocabulary token, or left unchanged with probabilities of 80%, 10%, and 10%, respectively. PacketEncoder is trained to reconstruct the original tokens from the corrupted sequence by minimizing
where denotes the set of masked positions, indexes a selected position, and is the corrupted input sequence.
MFP adopts the standard masked prediction objective, but applies it to a sequence constructed from parsed protocol fields and segmented packet contents rather than to an undifferentiated byte stream. Each prediction target therefore corresponds to a protocol field or part of one, and its context follows the protocol structure of the packet. This field-aligned construction introduces an explicit structural inductive bias, encouraging the model to exploit relationships among protocol elements when reconstructing masked tokens. For example, the prediction of a masked TLS record-type token may depend on adjacent version and length fields.
For each packet, the final hidden state at the [CLS] position serves as the semantic representation . This representation encodes field-aware protocol semantics,
Tong Guan et al.: Preprint submitted to Elsevier
Page 5 of 19 including dependencies among structured protocol fields, together with contextualized information from segmented byte tokens.
3.2. Feature Extraction and Adaptive Fusion
Packet-level protocol learning produces a semantic representation for each packet by encoding structured field information and packet-content patterns. Directional packet-length sequences provide a distinct source of discriminative information by characterizing the ordered variation of packet lengths and transmission directions.
For each packet, directional packet-length is defined as the product of its packet length and a signed direction indicator. This feature remains observable under payload encryption. A gated fusion module integrates the protocol-semantic and directional packet-length representations at the packet level. The fused packet representations are subsequently arranged in arrival order and passed to the flow-level fine-tuning stage. The feature extraction and fusion procedures are described in §3.2.1 and §3.2.2, respectively.
3.2.1. Heterogeneous Feature Extraction
Packet Semantic Sequence. After pre-training, the parameters of PacketEncoder are frozen throughout downstream training. Freezing PacketEncoder preserves the protocol knowledge acquired from unlabeled traffic and reduces the number of trainable parameters during task-specific adaptation.
For the -th packet, the tokenized packet sequence is fed into the frozen PacketEncoder, and the final hidden state at the [CLS] position is extracted as .
For a flow containing selected packets, the semantic representations are arranged according to packet arrival:
Directional Packet-length Sequence. As shown in Table 1, packet length, direction, and order remain observable across protection profiles. We therefore construct directional packet-length features to capture flow-level behavioral information.
For the -th packet, the transmission direction is encoded as , where denotes the client-to-server direction and denotes the server-to-client direction. Given its packet length , the directional packet-length is defined as
The resulting scalar is mapped to a d-dimensional directional packet-length representation through a learnable linear projection:
where denotes the directional packet-length representation of the -th packet. This projection enables direct feature-wise fusion with .
For a flow containing N selected packets, the sequential representations are arranged according to packet arrival:
3.2.2. Packet-level Gated Fusion
For the -th packet, the protocol-semantic representation and the directional packet-length representation are integrated by a gated fusion module. The concatenated representations are used to generate a feature-wise gate, which assigns a weight to each feature dimension of the two representations:
where denotes the sigmoid function and denotes element-wise multiplication.
The resulting integrates protocol-semantic information with directional packet-length information. Because the gate is conditioned on both input representations, their feature-wise contributions can vary across packets.
The fused packet representations are arranged in packet-arrival order to construct a flow-level sequence:
We refer to as the Semantic-Sequential Representation (SSR). SSR retains both information sources at the packet level while preserving packet order for subsequent flow-level modeling.
3.3. Flow-level Fine-tuning
Given the Semantic-Sequential Representation , a learnable [CLS] vector is prepended to the sequence:
The resulting sequence is fed into a BERT-based flow-level Transformer encoder, referred to as FlowEncoder. FlowEncoder follows the same encoder architecture as PacketEncoder but is independently initialized and optimized for each downstream task.
The final hidden state corresponding to the [CLS] position is used as the flow-level representation , which summarizes the packet-level information in SSR and the dependencies among packets in the flow.
FLARE optimizes FlowEncoder using downstream supervision and does not introduce an additional flow-level pre-training objective. The protocol-semantic representations are supplied by the frozen PacketEncoder, while task-relevant patterns in the directional packet-length features and their interactions with protocol-semantic information are learned during fine-tuning.
A task-specific classification head maps to a probability distribution over the target classes:
Tong Guan et al.: Preprint submitted to Elsevier
Page 6 of 19 where , and are learnable parameters of the classification head.
The model is trained by minimizing the cross-entropy loss
where denotes the number of target classes and is the ground-truth label indicator for class .
During fine-tuning, the gated fusion module, FlowEncoder, and classification head are jointly optimized, whereas PacketEncoder remains frozen. Consequently, the fusion weights and flow-level representations are adapted to the supervision provided by each downstream task. This design enables FLARE to adapt effectively across diverse downstream tasks, including application classification, malicious traffic detection, website fingerprinting, and encrypted network service classification.
4. Experiments
In this section, we describe the experiment setup and conduct a set of experiments to investigate the following Research Questions (RQ):
-
RQ1: Does FLARE achieve superior classification performance over representative baselines across diverse encrypted-traffic classification tasks?
-
RQ2: Can FLARE maintain effective classification performance under strong encryption as traffic observability becomes constrained?
-
RQ3: How do the learned fusion preferences between protocol-semantic and directional packet-length representations vary across traffic scenarios?
-
RQ4: How does each key component contribute to the classification performance of FLARE?
-
RQ5: How do the number of packets retained per flow and the number of labeled flows per class affect the classification performance of FLARE?
4.1. Experiment Setup
4.1.1. Datasets
Pre-training Datasets. For pre-training, we use ISCX-NonVPN [37], CIRA-CIC-DoHBrw-2020 [38], and the attack traffic from CIC-IoT-Dataset-2022 [39] as the pre-training corpus, totaling approximately 50 GB of traffic data. Since packet-level pre-training is designed to capture the semantics and structural organization of protocol fields, we deliberately construct the pre-training corpus using packets from heterogeneous protocols. The resulting corpus covers HTTP, TLS 1.2, TLS 1.3, FTP, SMTP, MQTT, CoAP, and DoH-related traffic, as well as diverse attack categories, thereby providing sufficient protocol and traffic diversity for effective unsupervised pre-training. Detailed statistics for each dataset are provided in Table 2.
Table 2 Statistical details of the pre-training datasets.
| Dataset | Size | Protocol |
|---|---|---|
| ISCX-NonVPN | 23 GB | HTTP, TLS 1.2, FTP, SMTP |
| CIC-IoT-2022-Attacks | 5.5 GB | HTTP, MQTT, CoAP |
| DoH-Malicious | 24 GB | TLS 1.2, TLS 1.3 |
Evaluation Datasets. During the fine-tuning stage, we evaluate FLARE on different datasets to assess its performance on downstream tasks. The statistical details of these datasets are summarized in Table 3.
CSTNET-TLS 1.3 Dataset [15] is a TLS 1.3 encrypted traffic dataset collected from the China Science and Technology Network, targeting fine-grained application identification under modern encryption.
ISCX-VPN Dataset [37] was released by the Canadian Institute for Cybersecurity in 2016, containing traffic from VPN connections. ISCX-VPN-App targets application-level identification, and ISCX-VPN-Service operates at a coarser granularity, grouping traffic into 6 service-type categories, including Chat, Email, FileTransfer, P2P, Streaming, and VoIP.
UNSW-TON-IoT Dataset [40] provides heterogeneous IoT network attack scenarios with 10 classes covering normal traffic and various attacks.
USTC-TFC Dataset [22] was published by the University of Science and Technology of China for traffic classification. It contains 10 benign and 10 malware traffic categories, totaling 20 classes, and is widely adopted for both malicious traffic detection and fine-grained application classification.
CIC-IoT-2022 Dataset [39] was released by the Canadian Institute for Cybersecurity, with traffic collected from real IoT deployments. Because its attack traffic is included in our unlabeled pre-training corpus, we exclude these samples from downstream fine-tuning. The resulting downstream task uses only benign traffic and classifies device traffic generated under different operational states.
CipherSpectrum Dataset [19] was introduced by the University of New South Wales in 2025 to address key limitations of existing datasets. It covers 41 domain classes, each represented by traffic encrypted under the three cipher suites mandated or recommended by TLS 1.3, including AES-128-GCM, AES-256-GCM, and ChaCha20-Poly1305. The dataset is designed for web traffic classification and supports cipher-agnostic network traffic classification research.
VisQUIC Dataset [20] is a large-scale dataset for encrypted QUIC traffic analysis. Samples are labeled by their corresponding website or server, and the dataset spans multiple QUIC implementations, including Chromium QUIC, Facebook mvfst, and Cloudflare quiche.
4.1.2. Compared Methods
To evaluate the performance of FLARE, we compare it with representative baselines from three methodological categories that broadly cover existing approaches to network traffic classification. (i) Traditional Methods:
Tong Guan et al.: Preprint submitted to Elsevier
Page 7 of 19
Table 3 The statistical details and collection environments of the fine-tuning datasets. WF denotes website fingerprinting.
| Dataset | Tasks | Collection Environment | Period | Flows | Labels |
|---|---|---|---|---|---|
| ISCX-VPN-Service | VPN-based Service Type Identification | University lab network (UNB); researcher-generated sessions over an external VPN service | 2016 | 1369 | 6 |
| ISCX-VPN-App | VPN-based Application Fingerprinting | University lab network (UNB); researcher-generated sessions over an external VPN service | 2016 | 1358 | 12 |
| USTC-TFC | Malware Detection | Malware: real-network captures (CTU); benign: emulated by IXIA BPS | 2011–2016 | 5202 | 20 |
| CIC-IoT-2022 | IoT Detection | IoT lab network (CIC, about 60 devices); controlled device-activity experiments | 2022 | 2000 | 5 |
| UNSW-TON-IoT | IoT Malware Detection | IoT/IloT testbed (UNSW Canberra Cyber Range); emulated normal and attack traffic | 2019 | 4804 | 10 |
| CSTNET-TLS 1.3 | TLS 1.3-based WF | National research and education backbone (CSTNET); passively captured traffic | 2021 | 7091 | 51 |
| CipherSpectrum | TLS 1.3-based WF (Multi-Cipher Suites) | Controlled client-side collection; automated Chromium/Firefox browsing with three TLS 1.3 AEAD cipher suites | 2024 | 20500 | 41 |
| VisQUIC | QUIC-based WF | Two residential networks on different continents; automated Headless Chrome browsing around the clock | 2023–2024 | 8000 | 16 |
AppScanner [10] and BIND [11]. (ii) Deep Learning Methods: LEXNet [24], FS-Net [13], DeepPacket [12], and Deep Fingerprinting (DF) [14]. (iii) Pre-training Methods: ET-BERT [15], YaTC [32], BERT-ps [41], and TrafficFormer [18].
4.1.3. Implementation Details
All experiments are conducted on a server equipped with 8 NVIDIA GeForce RTX 4090 GPUs, running Python 3.9.23 and PyTorch 2.6.0 (CUDA 12.4). Both PacketEncoder and the flow-level encoder follow the standard BERT architecture, consisting of 12 Transformer encoder layers with a hidden dimension of and 12 attention heads. The maximum byte sequence length per packet is set to , and the first packets are retained per flow.
Packet-level Pre-training. The PacketEncoder is optimized using the Adam optimizer with a learning rate of over 500,000 training steps. The training loss stabilizes at approximately 300,000 steps; we therefore adopt the checkpoint at step 300,000 as the final packet-level encoder for all subsequent experiments. On all evaluated datasets, network-layer and transport-layer header fields are parsed for every packet. An independent audit based on TCP reassembly shows that 99.74% of the TLS record headers within the retained bytes are parsed, with only 6 false positives among about 2.27 million parsed headers (Appendix A).
Flow-level Fine-tuning. During fine-tuning, the Adam optimizer is employed with a learning rate of and a batch size of 32. The maximum number of training epochs is set to 80, with early stopping applied if no improvement in validation performance is observed for 10 consecutive epochs. For downstream fine-tuning and evaluation, datasets are partitioned at the flow level into training, validation, and test sets following an 8:1 ratio. All packets from the same flow are retained in the same partition [42], and the split is performed before sequence construction. At most 500 flows per class are sampled from the training set. The final model is
selected based on validation performance, while the test set is used only for final evaluation. To reduce the influence of random initialization and data sampling, all reported results are averaged over five independent runs under the same experimental settings.
4.1.4. Evaluation Metrics
We evaluate classification performance using accuracy, macro-precision, macro-recall, and macro-F1. Accuracy (Acc) measures the proportion of correctly classified samples. For each class, precision measures the proportion of samples predicted as that class that are correctly classified, while recall measures the proportion of samples belonging to that class that are correctly identified. F1 is the harmonic mean of precision and recall. Macro-precision (PR), macro-recall (RC), and macro-F1 (F1) are obtained by averaging the corresponding class-wise metrics with equal weight, thereby accounting for the performance of all classes regardless of their sample sizes. Unless otherwise specified, precision, recall, and F1 refer to their macro-averaged variants.
4.2. Comparison Experiments (RQ1)
We compare FLARE with various baseline methods on six public traffic datasets, covering TLS 1.3 application traffic (CSTNET-TLS 1.3), VPN-tunneled traffic (ISCX-VPN-Service, ISCX-VPN-App), malicious traffic (USTC-TFC), and IoT traffic (UNSW-TON-IoT, CIC-IoT-2022). The experimental results are presented in Table 4 and Table 5.
High F1 across multiple classification tasks. FLARE achieves the highest macro-F1 scores on five of the six datasets, with its largest gain reaching 3.13% over the best-performing baseline on UNSW-TON-IoT. Methods based on statistical features and machine learning obtain the weakest performance; deep learning models perform better, and pre-trained models achieve the best results among the baselines. FLARE consistently outperforms methods from all three categories across VPN traffic classification, website
Tong Guan et al.: Preprint submitted to Elsevier
Page 8 of 19
Table 4 Comparison results on CSTNET-TLS 1.3, ISCX-VPN-Service and ISCX-VPN-App. The best and second-best results are shown in boldface and underlined, respectively.
| Methods | CSTNET-TLS 1.3 | ISCX-VPN-Service | ISCX-VPN-App | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Acc | PR | RC | F1 | Acc | PR | RC | F1 | Acc | PR | RC | F1 | |
| AppScanner | 0.2763 | 0.7976 | 0.2475 | 0.3475 | 0.6705 | 0.8203 | 0.5396 | 0.6413 | 0.5210 | 0.6580 | 0.4488 | 0.5523 |
| BIND | 0.6755 | 0.7146 | 0.6755 | 0.6695 | 0.8476 | 0.8590 | 0.8476 | 0.8477 | 0.4292 | 0.4208 | 0.4292 | 0.3954 |
| LEXNet | 0.7860 | 0.7743 | 0.7448 | 0.7506 | 0.8261 | 0.8313 | 0.8456 | 0.8359 | 0.8095 | 0.7584 | 0.7062 | 0.7243 |
| FS-Net | 0.8399 | 0.8194 | 0.7971 | 0.7995 | 0.8455 | 0.8689 | 0.8390 | 0.8498 | 0.7919 | 0.7311 | 0.7240 | 0.7117 |
| DeepPacket | 0.6628 | 0.4808 | 0.4024 | 0.4131 | 0.8704 | 0.7341 | 0.7056 | 0.7017 | 0.8000 | 0.7521 | 0.7097 | 0.6975 |
| DF | 0.5563 | 0.5406 | 0.5316 | 0.5193 | 0.7361 | 0.7771 | 0.7300 | 0.7417 | 0.7279 | 0.5653 | 0.5500 | 0.5449 |
| ET-BERT | 0.5642 | 0.5085 | 0.5105 | 0.4741 | 0.8889 | 0.8994 | 0.8971 | 0.8957 | 0.9265 | 0.9174 | 0.8843 | 0.8806 |
| YaTC | 0.8745 | 0.8756 | 0.8745 | 0.8701 | 0.9098 | 0.9080 | 0.9098 | 0.9071 | 0.8846 | 0.8703 | 0.8846 | 0.8758 |
| BERT-ps | 0.9140 | 0.9122 | 0.9088 | 0.9068 | 0.9270 | 0.9222 | 0.9140 | 0.9132 | 0.8015 | 0.6303 | 0.6422 | 0.6319 |
| TrafficFormer | 0.7601 | 0.7258 | 0.7267 | 0.7148 | 0.8810 | 0.8863 | 0.8634 | 0.8722 | 0.8095 | 0.8069 | 0.7169 | 0.7373 |
| FLARE | 0.9456 | 0.9406 | 0.9238 | 0.9255 | 0.9301 | 0.9293 | 0.8887 | 0.9251 | 0.9189 | 0.9053 | 0.9118 | 0.9009 |
Table 5 Comparison results on UNSW-TON-IoT, USTC-TFC and CIC-IoT-2022. The best and second-best results are shown in boldface and underlined, respectively.
| Methods | UNSW-TON-IoT | USTC-TFC | CIC-IoT-2022 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Acc | PR | RC | F1 | Acc | PR | RC | F1 | Acc | PR | RC | F1 | |
| AppScanner | 0.7040 | 0.7128 | 0.7040 | 0.7000 | 0.4532 | 0.8634 | 0.5946 | 0.6430 | 0.2125 | 0.4237 | 0.4610 | 0.3535 |
| BIND | 0.7944 | 0.8072 | 0.7944 | 0.7916 | 0.8451 | 0.8595 | 0.8451 | 0.8385 | 0.7939 | 0.7937 | 0.7939 | 0.7892 |
| LEXNet | 0.7892 | 0.7916 | 0.8026 | 0.7853 | 0.7757 | 0.8709 | 0.8386 | 0.8474 | 0.7000 | 0.7001 | 0.7022 | 0.7000 |
| FS-Net | 0.8484 | 0.8422 | 0.8626 | 0.8382 | 0.7869 | 0.8663 | 0.8360 | 0.8359 | 0.7297 | 0.7331 | 0.7349 | 0.7348 |
| DeepPacket | 0.9100 | 0.9126 | 0.9100 | 0.9094 | 0.8571 | 0.6019 | 0.5769 | 0.5435 | 0.7250 | 0.7295 | 0.7250 | 0.7258 |
| DF | 0.5832 | 0.6254 | 0.5742 | 0.5687 | 0.6799 | 0.6934 | 0.6661 | 0.6491 | 0.5823 | 0.5856 | 0.5816 | 0.5627 |
| ET-BERT | 0.8043 | 0.8259 | 0.8040 | 0.8023 | 0.9677 | 0.9746 | 0.9660 | 0.9683 | 0.7991 | 0.8208 | 0.8034 | 0.8100 |
| YaTC | 0.8882 | 0.8913 | 0.8882 | 0.8890 | 0.9733 | 0.9734 | 0.9733 | 0.9733 | 0.8525 | 0.8539 | 0.8525 | 0.8520 |
| BERT-ps | 0.7914 | 0.8017 | 0.7920 | 0.7915 | 0.8392 | 0.8750 | 0.8785 | 0.8757 | 0.7938 | 0.8483 | 0.7816 | 0.7976 |
| TrafficFormer | 0.8609 | 0.8946 | 0.8512 | 0.8609 | 0.9952 | 0.9867 | 0.9827 | 0.9845 | 0.7258 | 0.7286 | 0.7278 | 0.7278 |
| FLARE | 0.9431 | 0.9513 | 0.9381 | 0.9407 | 0.9885 | 0.9908 | 0.9753 | 0.9908 | 0.8621 | 0.8722 | 0.8759 | 0.8349 |
fingerprinting, malicious traffic detection, and IoT traffic classification.
The discriminative value of different traffic representations varies across traffic scenarios. The experimental results show that byte-based methods hold a clear advantage over sequence-based methods on USTC-TFC: DeepPacket outperforms FS-Net by 7.02% in accuracy, and TrafficFormer outperforms BERT-ps by 15.6%. This is because 98.9% of the traffic in USTC-TFC is unencrypted [19], consisting largely of plaintext HTTP, custom binary protocols, or weakly encrypted communication, which allows byte-based methods to extract highly discriminative content directly from the raw traffic. In contrast, sequence-based methods are less effective because many malware flows consist of short heartbeat or command-response exchanges, with limited variation in flow length, packet count, and interaction patterns. Such simple transmission behaviors provide weak inter-class separation for sequence modeling.
CSTNET-TLS 1.3 contains encrypted traffic protected by AEAD cipher suites, as mandated by TLS 1.3. On this dataset, the sequence-based FS-Net outperforms DeepPacket by 17.71%, and BERT-ps outperforms TrafficFormer by 15.39%. These results indicate that byte-based models can exploit only a small amount of residual content information when facing strongly encrypted traffic, since most payload bytes no longer carry effective semantic features for classification, leading to a marked degradation in their performance. Packet lengths and directions, however, remain observable under payload encryption. In addition, CSTNET-TLS 1.3 targets website identification. Differences in page structure, resource size, and request-response order are reflected in distinctive packet-length and direction sequences, favoring sequence-based methods.
The above analysis demonstrates that the effective discriminative information of a traffic dataset resides in different features, depending on its protocol characteristics and classification tasks: for weakly encrypted malware traffic
Tong Guan et al.: Preprint submitted to Elsevier
Page 9 of 19
Table 6
Comparison results under strong encryption across CipherSpectrum (AES-128-GCM, AES-256-GCM, ChaCha20-Poly1305, and a mixed suite), CSTNET-TLS 1.3, and VisQUIC. The SNI field is removed for all methods, and the best result in each column is shown in bold.
| Methods | CipherSpectrum | CSTNET-TLS 1.3 | VisQUIC | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| aes-128-gcm | aes-256-gcm | chacha20-poly1305 | mix | Acc | F1 | |||||
| Acc | F1 | Acc | F1 | Acc | F1 | Acc | F1 | |||
| LEXNet | 0.8650 | 0.8637 | 0.8618 | 0.8583 | 0.8645 | 0.8643 | 0.8483 | 0.8487 | 0.7860 | 0.7506 |
| FS-Net | 0.8746 | 0.8735 | 0.8737 | 0.8734 | 0.8745 | 0.8737 | 0.8635 | 0.8640 | 0.8399 | 0.7995 |
| DeepPacket | 0.1457 | 0.1402 | - | - | - | - | 0.1561 | 0.1432 | 0.6628 | 0.4131 |
| DF | 0.5342 | 0.5247 | 0.5548 | 0.5471 | 0.5408 | 0.5398 | 0.5360 | 0.5291 | 0.5563 | 0.5193 |
| ET-BERT | 0.4464 | 0.3708 | 0.4996 | 0.4466 | 0.4589 | 0.3903 | 0.4283 | 0.3856 | 0.5642 | 0.4741 |
| YaTC | 0.9610 | 0.9609 | 0.9683 | 0.9682 | 0.9695 | 0.9696 | 0.9402 | 0.9402 | 0.8745 | 0.8701 |
| TrafficFormer | 0.9582 | 0.9580 | 0.9717 | 0.9717 | 0.9638 | 0.9637 | 0.9389 | 0.9388 | 0.7601 | 0.7148 |
| FLARE | 0.9861 | 0.9862 | 0.9810 | 0.9810 | 0.9963 | 0.9963 | 0.9937 | 0.9937 | 0.9456 | 0.9255 |

(a) ET-BERT
(b) FS-Net
(c) YaTC
(d) FLARE
Figure 2: The t-SNE visualization of feature representations on CipherSpectrum-mix dataset.
generated by homogeneous code, the discriminative information concentrates in the byte representation, whereas for strongly encrypted website traffic with heterogeneous behaviors, it derives primarily from the sequential representation. Consequently, single-representation methods tend to excel only on datasets that favor their respective representations. FLARE therefore adaptively fuses the semantic and sequential representations, which improves generalization and enables effective classification performance across six heterogeneous datasets.
4.3. Classification under Strong Encryption (RQ2)
To evaluate FLARE under strong encryption, we select three website identification datasets representing progressively more constrained protocol observability. CipherSpectrum encrypts traffic with the AEAD cipher suites mandated by TLS 1.3, covering AES-128-GCM-SHA256, AES-256-GCM-SHA384, CHACHA20-POLY1305-SHA256, and a mixed subset combining all three, which enables a fine-grained comparison across cipher suites. Since its ClientHello messages expose SNI in plaintext, we remove the SNI field to prevent identity-based shortcut learning. CSTNET-TLS 1.3 also contains TLS 1.3 traffic. For this dataset, we discard the packet containing the ClientHello message and all preceding packets in each flow, thereby removing both the plaintext SNI and additional early-connection context.
Table 7
Accuracy of FLARE under inference-time masking of shortcut-prone header fields. denotes the change in accuracy, measured in percentage points, relative to the full-input setting.
| Masked fields | CipherSpectrum-mix | CSTNET-TLS 1.3 | ||
|---|---|---|---|---|
| Acc | (pp) | Acc | (pp) | |
| None | 0.9937 | - | 0.9456 | - |
| IP ID | 0.9801 | -1.36 | 0.9337 | -1.19 |
| Checksum | 0.9840 | -0.97 | 0.9589 | +1.33 |
| ACK | 0.9864 | -0.73 | 0.9369 | -0.87 |
| SEQ | 0.9854 | -0.83 | 0.9298 | -1.58 |
| TCP Window | 0.9835 | -1.02 | 0.9305 | -1.51 |
VisQUIC consists of QUIC traffic, in which most transport-control information is carried in protected frames and the packet number and selected header bits are subject to header protection. Consequently, VisQUIC exposes fewer directly visible transport-layer fields than TLS-over-TCP datasets. Under these preprocessing settings, none of the evaluated methods has access to SNI information. Detailed dataset statistics are provided in Table 3.
High accuracy under increasingly constrained observability. FLARE achieves the highest accuracy on all strongly encrypted datasets. Compared with the strongest
Tong Guan et al.: Preprint submitted to Elsevier
Page 10 of 19 pre-trained baseline on each dataset, FLARE improves the average accuracy by 2.95% on CipherSpectrum, 7.11% on CSTNET-TLS 1.3, and 10.92% on VisQUIC, respectively; compared with the strongest deep learning baseline, the improvements are 11.77%, 10.57%, and 3.92%, respectively. Furthermore, across the four cipher-suite subsets of CipherSpectrum, the accuracy of FLARE varies by at most 1.53%, indicating that its classification capability is agnostic to the specific cipher suite. Notably, FLARE is the only model that consistently surpasses both all pre-trained and all deep learning baselines across the three datasets.
Payload-based methods perform poorly under strong encryption. ET-BERT, which relies entirely on payload data, attains average accuracies of only 45.83% on CipherSpectrum (averaged across its four cipher-suite subsets), 56.42% on CSTNET-TLS 1.3, and 56.25% on VisQUIC, a marked decline from its performance on weakly encrypted public datasets in §4.2. Under strong payload protection, byte-oriented models may rely on ciphertext-specific statistical regularities because directly interpretable application semantics are largely unavailable. In contrast, YaTC implicitly captures inter-packet information through its byte-matrix arrangement, and TrafficFormer learns the ordering relations among bursts through its pre-training tasks; both consequently retain considerably better performance on the three datasets. This disparity indicates that the degradation of pre-trained models is proportional to their reliance on payload semantics, which further corroborates the value of sequence-level information under strong encryption.
Sequence features remain discriminative under strong encryption. Sequence-based methods such as LEXNet and FS-Net maintain competitive and stable classification performance across the three datasets, and in certain settings surpass some pre-trained methods. Notably, on VisQUIC, the most strongly encrypted dataset, DF outperforms all pre-trained baselines, providing direct evidence that sequential features alone retain strong discriminative information. Nevertheless, sequence-based methods face an inherent performance ceiling, as they are unable to exploit the residual plaintext fields in protocol interactions. FLARE still outperforms the strongest sequence-based method by 3.92% on VisQUIC, and this margin is attributable to its semantic representation learning by parsing the remaining header fields, together with the gating mechanism effectively arbitrating between semantic and sequential representations. These results validate the design of FLARE: field-level semantic parsing preserves the residual value of the semantic representation under strong encryption, while allowing the model to rely more on the sequential representation if semantic information diminishes, jointly enabling the best classification performance under diverse traffic classification tasks.
Performance does not stem from shortcut fields. To determine whether FLARE relies on shortcut-prone header fields, we individually mask the IP ID, checksum, TCP sequence number, acknowledgment number, and window
size at inference time. As shown in Table 7, no single-field masking operation causes a substantial performance collapse. The largest accuracy decreases are 1.36% after masking the IP ID on CipherSpectrum-mix and 1.58% after masking the sequence number on CSTNET-TLS 1.3. Moreover, removing the checksum improves the accuracy on CSTNET-TLS 1.3 by 1.33%, suggesting that it is not a stable discriminative field. These results indicate that FLARE does not rely heavily on any tested field.
FLARE learns more separable representations under strong encryption. Figure 2 visualizes the feature representations learned by different methods on CipherSpectrum-mix. ET-BERT and YaTC exhibit noticeable inter-class overlap and scattered within-class distributions for several traffic categories. FS-Net forms several relatively compact clusters, indicating that packet-length and direction sequences retain useful behavioral information under strong encryption, although some behaviorally similar classes remain entangled. In contrast, FLARE produces clearer class boundaries with less local overlap, demonstrating improved intra-class consistency and inter-class separability. This improvement can be attributed to the joint modeling of protocol semantics from packet-header fields and observable packet-length and direction patterns. The visualization is consistent with the quantitative classification results.
4.4. Fusion Preference Analysis (RQ3)
To characterize the fusion preferences learned for different downstream datasets, we analyze the feature-wise gates produced by the gated fusion module. As defined in Eqs. (6) and (7), assigns a weight to each feature dimension of the protocol-semantic representation at the -th packet position of flow , while the directional packet-length representation receives the complementary weight .
We define the dataset-level semantic fusion preference score as the mean semantic gate allocation over all non-padding packet positions:
where denotes the set of flows in the dataset, is the number of non-padding packet positions in flow , and denotes the -th component of the gate vector at the -th packet position. The corresponding sequential fusion preference score is defined as
By construction, and . These scores summarize the average gate allocations assigned to the protocol-semantic and directional packet-length representations and serve as proxies for the fusion preference learned on dataset . A higher indicates that the gated fusion module assigns greater average weight to protocol-semantic representation, whereas a higher indicates greater
Tong Guan et al.: Preprint submitted to Elsevier
Page 11 of 19

Figure 3: Fusion preferences learned by FLARE for different downstream datasets. Semantic preference is quantified by the mean semantic gate , while sequential preference is defined as . These quantities serve as dataset-level proxies for the relative weighting of the two representations. Datasets are ordered by decreasing semantic preference.
average weight on directional packet-length representation. Comparing these scores across datasets characterizes the task-specific fusion preferences learned during downstream fine-tuning.
We conduct the fusion preference analysis on CSTNET-TLS 1.3, ISCX-VPN-Service, ISCX-VPN-App, UNSW-TON-IoT, USTC-TFC, and the mixed cipher-suite subset of CipherSpectrum (CipherSpectrum-mix). The results are shown in Figure 3.
Across the six dataset-specific fine-tuned models, the mean semantic preference ranges from 7.2% to 37.5%, with the corresponding sequential preference ranging from 62.5% to 92.8%. These differences indicate that task-specific fine-tuning yields distinct fusion preferences rather than a uniform weighting scheme across datasets. Among the evaluated datasets, ISCX-VPN-Service and ISCX-VPN-App exhibit the highest semantic preference, suggesting that the parsable protocol information retained after VPN encapsulation remains useful for these classification tasks. In contrast, CipherSpectrum-mix exhibits the lowest semantic preference, as its traffic is strongly encrypted under TLS 1.3, leaving few informative fields available, and the model consequently assigns greater weight to the sequential representation. This pattern is consistent with the effectiveness of semantic and sequential representations discussed in §4.2.
USTC-TFC deserves particular discussion. Although §4.2 shows that this dataset favors byte-based classification due to its largely unencrypted payloads, FLARE deliberately restricts its semantic input to a short byte prefix and emphasizes parsed protocol fields rather than full-payload content, in order to remain effective under strong encryption and to avoid shortcut features. As a result, the semantic representation cannot exploit the signature-like payload patterns in USTC-TFC, and the model shifts most of its preference to the sequential representation. This design choice may partly explain why FLARE performs slightly below TrafficFormer on this dataset, representing

Figure 4: Distribution of the mean gate value of each flow, averaged over its packets and gate dimensions, across the 41 classes of CipherSpectrum-mix. Classes are ordered by median.
a deliberate trade-off between exploiting plaintext payloads and maintaining robustness on encrypted traffic. Notably, the semantic preference on USTC-TFC still reaches 27.4%, considerably higher than that on CipherSpectrum-mix, indicating that header fields alone provide non-negligible discriminative information even without access to payload content.
These results indicate that the gated fusion module learns distinct task-specific preferences for the protocol-semantic and directional packet-length representations. By adaptively adjusting the gate under downstream supervision, FLARE can better exploit the discriminative information available in different traffic scenarios.
Fine-grained gate analysis. Beyond dataset-level preferences, the gate also varies across classes and between packet types within a flow, although these variations are largely hidden in the mean gate value. On CipherSpectrum-mix, class membership explains 82.3% of the variation in the mean gate value of a flow (Figure 4), and a weaker class effect is observed on VisQUIC. By contrast, packet position explains less than 0.5% of this variation, indicating that the overall balance between the two representations remains stable along a flow. The gate nevertheless changes systematically between packet types. On CipherSpectrum-mix, plaintext handshake records, which expose parsable protocol fields, and the encrypted records that follow receive almost identical mean gate values, yet 700 of the 768 gate dimensions differ significantly between them after correction for multiple comparisons (Figure 5). Because these dimensions shift in opposite directions, their differences cancel out in the mean. Global-weight fusion uses one weight vector for all packets, and flow-level gated fusion uses one gate for all packets within a flow, so neither can express such changes between packets of the same flow. This may explain the advantage of packet-level gating in the ablation study.
4.5. Ablation Study (RQ4)
To validate the design of FLARE, we conduct ablation studies on four representative datasets, including CSTNET-TLS 1.3, ISCX-VPN-App, UNSW-TON-IoT, and CipherSpectrum-mix, to assess the contribution of each component. The results are presented in Table 8.
Tong Guan et al.: Preprint submitted to Elsevier
Page 12 of 19
Table 8 Ablation Study of FLARE on four datasets.
| Modules | CSTNET-TLS 1.3 | ISCX-VPN-App | UNSW-TON-IoT | CipherSpectrum-mix | ||||
|---|---|---|---|---|---|---|---|---|
| Acc | F1 | Acc | F1 | Acc | F1 | Acc | F1 | |
| w/o Semantic representation | 0.9057 | 0.8875 | 0.8311 | 0.6831 | 0.9183 | 0.9176 | 0.9777 | 0.9750 |
| Byte-level pre-training | 0.8167 | 0.7888 | 0.7905 | 0.7110 | 0.8047 | 0.8007 | 0.9707 | 0.9709 |
| w/o Sequential representation | 0.8184 | 0.7779 | 0.7905 | 0.7085 | 0.8346 | 0.8156 | 0.8493 | 0.8475 |
| w/o Sequential feature & length fields | 0.4529 | 0.3876 | 0.7310 | 0.7287 | 0.6629 | 0.6395 | 0.7165 | 0.7151 |
| w/o Packet length | 0.8619 | 0.8348 | 0.8311 | 0.8196 | 0.8743 | 0.8610 | 0.8946 | 0.8942 |
| w/o Packet direction | 0.9442 | 0.9341 | 0.8851 | 0.8737 | 0.9313 | 0.9290 | 0.9907 | 0.9907 |
| Equal-weight fusion | 0.9124 | 0.8864 | 0.8176 | 0.7043 | 0.9001 | 0.8891 | 0.9917 | 0.9917 |
| Global-weight fusion | 0.9216 | 0.9038 | 0.9094 | 0.8957 | 0.9033 | 0.8977 | 0.9851 | 0.9852 |
| Flow-level gated fusion | 0.9282 | 0.9051 | 0.8850 | 0.8752 | 0.9258 | 0.9211 | 0.9902 | 0.9902 |
| FLARE | 0.9456 | 0.9255 | 0.9189 | 0.9009 | 0.9431 | 0.9407 | 0.9937 | 0.9937 |

Figure 5: Per-dimension difference in mean gate value between plaintext handshake records and encrypted records (handshake minus encrypted) on CipherSpectrum-mix, sorted in ascending order. Red points denote dimensions that differ significantly after Benjamini–Hochberg correction (adjusted ). The dashed line marks the mean difference across all dimensions, which is close to zero because positive and negative differences cancel out. Encrypted records include both the encrypted remainder of the handshake and application data.
Protocol semantics are effective, and field-aware pre-training preserves them. Removing the semantic representation degrades the classification accuracy of FLARE by 1.60 percentage points on CipherSpectrum-mix, 3.99 on CSTNET-TLS 1.3, 2.48 on UNSW-TON-IoT, and 8.78 on ISCX-VPN-App. The reduction is smallest on CipherSpectrum-mix, where stronger protection leaves less informative protocol-field information available to the model. Across datasets, the size of the drop follows the fusion preferences measured in §4.4: ISCX-VPN-App, which exhibits the highest semantic preference, suffers the largest drop, whereas CipherSpectrum-mix, with the lowest preference, is affected the least. Notably, even on CipherSpectrum-mix, removing the semantic representation still causes a non-negligible loss, indicating that the semantic branch provides discriminative information across all scenarios. To further isolate the effect of field-level parsing, we replace the parsed fields with raw bytes for
pre-training while keeping the architecture, pre-training objective, and training procedure identical. This byte-level variant underperforms FLARE by 10.47 percentage points on average. Since the two variants differ only in how the input is constructed, this gap indicates that field-aligned input enables the encoder to learn more effective protocol-semantic representations of packets.
Since length fields encode information that overlaps with the sequential representation, we further mask the length fields of the network and transport layers in the variant without the sequential representation. Accuracy decreases on all four datasets, most notably by 36.55 percentage points on CSTNET-TLS 1.3, but remains at 71.65%, 45.29%, 73.10%, and 66.29% on CipherSpectrum-mix, CSTNET-TLS 1.3, ISCX-VPN-App, and UNSW-TON-IoT, respectively. Beyond length information, the remaining protocol fields thus provide discriminative features, even on strongly encrypted traffic.
Sequential features are essential for classification. Removing the sequential representation causes the largest degradation among all ablation settings, with an average accuracy drop of 12.71% and a maximum drop of 14.44% on CipherSpectrum-mix. Notably, CipherSpectrum-mix, which suffers the smallest loss in the semantic ablation (1.60%), exhibits the largest loss when the sequential branch is removed (14.44%), a contrast consistent with its dominant sequential preference measured in §4.4. We further decompose the sequential features into the packet length sequence and the packet direction sequence. The length sequence encodes the volume characteristics of the transmitted content and distinguishes the functional roles of packets, such as full-sized data packets versus short control messages. The direction sequence characterizes the interaction pattern between endpoints, reflecting the request-response rhythm and the traffic asymmetry between, for instance, bulk-download services and interactive applications. Removing the length sequence reduces the average accuracy by 8.49%, compared with 1.25% for the direction sequence, indicating that both components contribute to classification while the length
Tong Guan et al.: Preprint submitted to Elsevier
Page 13 of 19 sequence plays the more prominent role. By fusing directional packet-length sequence with the semantic representation through the gating network, FLARE exploits the transmission patterns that remain discriminative regardless of encryption, which underpins its performance across diverse datasets.
Fine-grained adaptive gated fusion is effective. To evaluate the fusion design, we compare FLARE with three variants of increasing adaptivity. The equal-weight variant bypasses the gating network and fuses the semantic and sequential representations with a constant weight of 0.5. The global-weight variant replaces the gate with feature-wise weights that are learned during fine-tuning but shared by all inputs, thereby allowing a dataset-specific fusion ratio. The flow-level variant computes a single gate for each flow from the pooled packet representations. As shown in Table 8, FLARE achieves the highest accuracy on all four datasets. The equal-weight variant shows the largest degradation, reaching 10.13 percentage points on ISCX-VPN-App. The global-weight and flow-level variants remain 0.86 to 3.98 and 0.35 to 3.39 percentage points below FLARE, respectively. These results suggest that computing the fusion weights separately for each packet, conditioned on its own representations, is more effective than fusion that adapts only at the dataset or flow level.
4.6. Sensitivity Analysis (RQ5)
We examine the sensitivity of FLARE to two parameters that determine the amount of input and supervision: the number of packets retained per flow and the number of labeled training flows per class. The results are shown in Figure 6a and Figure 6b, respectively.
How many packets per flow are needed? We vary the number of packets retained per flow as on CSTNET-TLS 1.3, ISCX-VPN-App, UNSW-TON-IoT, and CipherSpectrum-mix, while fixing the per-packet input length to B, consistent with the pre-training configuration.
Despite minor fluctuations at smaller packet counts, accuracy generally increases with N and reaches its highest or near-highest level at N = 64 on all four datasets, whereas increasing N to 128 yields a slight decrease, suggesting that later packets contribute limited additional information and may introduce redundant patterns. The datasets also differ in their sensitivity. FLARE already achieves high accuracy with the first eight packets on CipherSpectrum-mix and CSTNET-TLS 1.3, indicating that much of the useful information is concentrated in the early stage of a flow, whereas ISCX-VPN-App and UNSW-TON-IoT benefit more from longer sequences. Considering validation performance and input overhead, we set N = 64 as the default.
How many training flows per class are needed? To examine the effect of the 500-flow bound on the training set, we conduct this analysis on UNSW-TON-IoT, CipherSpectrum-mix, and VisQUIC, which cover IoT attack traffic, TLS 1.3 traffic, and QUIC traffic, respectively. In these datasets, most classes contain more than 500 flows, so the bound

(a) Number of packets per flow
(b) Number of flows per class
Figure 6: Sensitivity of FLARE to (a) the number of packets per flow and (b) the number of flows per class. "Full" denotes all remaining flows after constructing the test set.
determines how much of the available labeled data is used; in the remaining datasets, most classes contain fewer than 500 flows, and the bound has little effect. For each dataset, we fix a class-balanced test set of 100 flows per class and vary the number of training flows per class as , where Full denotes all remaining flows.
As shown in Figure 6b, accuracy rises sharply on all three datasets from 10 to 100 flows per class. CipherSpectrum-mix then saturates, whereas UNSW-TON-IoT and VisQUIC continue to improve up to 500 flows per class. With the full training set, accuracy decreases by 5.48 percentage points on UNSW-TON-IoT owing to class imbalance, changes only slightly on CipherSpectrum-mix, and increases by a further 4.99 percentage points on VisQUIC, where most packet content is protected, so the reported results on VisQUIC are conservative. Overall, a few hundred labeled flows per class suffice for most tasks, and the 500-flow bound, which follows ET-BERT [15] and TrafficFormer [18], ensures a fair comparison with these baselines while avoiding the class imbalance of the full training set.
5. Discussion
Implications. As TLS 1.3 and QUIC continue to evolve and gain adoption, strong-encryption settings are likely to become increasingly relevant to practical traffic classification. The degradation of payload-driven methods observed in our experiments is consistent with the reduced availability of plaintext-derived information under modern encryption. The results suggest that the relative utility of protocol-semantic and behavioral information varies across traffic datasets, highlighting the importance of evaluation under diverse protocols, traffic types, and encryption settings.
Generalization. The main experiments use random per-flow splits and therefore measure performance under a shared data distribution. We further examine FLARE under three types of distribution shift (Appendix B). First, changing the cipher suite on CipherSpectrum introduces a substantial shift, reducing accuracy from 98.61% to between 64.24% and 77.46%. Second, under simulated network perturbations, FLARE is robust to packet retransmission, with accuracy decreasing by at most 1.46 percentage.
Tong Guan et al.: Preprint submitted to Elsevier
Page 14 of 19 points, whereas packet loss reduces accuracy by up to 9.56 percentage points at a 20% loss rate. Third, on ISP backbone traffic from CESNET DataZoo, where only flow-level metadata is available and FLARE uses the directional packet-length representation alone, performance degrades gradually under temporal drift, with macro-F1 remaining at 75.16% after nearly one year without retraining, and declines smoothly as the number of classes increases to more than one hundred.
Transfer to new networks. FLARE can be transferred to a new network without re-pre-training. The frozen PacketEncoder is reused directly, and only the gated fusion module, FlowEncoder, and the classification head are fine-tuned on labeled flows from the target network, which typically requires a few hundred flows per class. If the target network carries protocols that the current parser does not support, the field-parsing rules need to be extended, and PacketEncoder may require supplementary pre-training on unlabeled traffic.
Limitations. First, FLARE parses packets individually without TCP reassembly, so protocol fields beyond the retained bytes of each packet are not available to the semantic representation. Second, FLARE has not yet been evaluated on datasets that span multiple collection environments or provide long-term packet-level captures, and its generalization across environments and over time remains to be verified. Third, FLARE does not incorporate timing features, and its robustness to active obfuscation such as padding and traffic shaping has not been evaluated. Finally, the strongly encrypted datasets considered here focus on website fingerprinting and do not cover security tasks such as encrypted malware and intrusion detection.
Future Work. Future work will investigate timing-aware behavioral representations, additional strong-encryption tasks, and lightweight packet encoders for high-throughput inference. We also plan to evaluate FLARE on packet-level captures spanning multiple environments and longer periods, and to develop field-level attribution, enabled by its field-aligned input, to clarify which observable information the model relies on. Finally, field-aware representations should be extended as emerging protocols continue to alter the set of observable header information.
6. Conclusion
The continued evolution of traffic encryption reduces the application content and high-level handshake information available to traffic classifiers, while the discriminative value of the remaining observable information varies across traffic scenarios. This paper introduces FLARE, which learns packet-level protocol-semantic representations through field-aware pre-training and adaptively integrates them with flow-level directional packet-length representations using a gating network. Experiments on diverse datasets show that FLARE consistently outperforms representative traditional machine-learning, deep-learning, and pre-trained baselines.
Gating-weight analysis and ablation studies further indicate that FLARE captures scenario-dependent reliance on protocol-semantic and behavioral information. In strong-encryption settings involving TLS 1.3 and QUIC, FLARE achieves consistent improvements over both byte-driven and sequence-driven baselines. These findings confirm the value of adaptively integrating residual protocol semantics and observable traffic behavior for classification under constrained observability.
Acknowledgement
This work was supported by National Natural Science Foundation of China (No. U25A6023) and the Cybersecurity Professional Committee of the Chinese Association of Educational Technology (NO. 2023CAET1002).
References
[1] Ons Aouedi, Van An Le, Kandaraj Piamrat, and Yusheng Ji. Deep learning on network traffic prediction: Recent advances, analysis, and future directions. ACM Computing Surveys, 57(6):1–37, 2025.
[2] Google. HTTPS Encryption on the Web. https://transparencyreport.google.com/https?hl=en, 2024. Google Transparency Report, archived August 2024, accessed 23 July 2026.
[3] Cloudflare. Adoption and Usage Worldwide. Cloudflare Radar, 2026. Accessed 23 July 2026; statistics retrieved for the selected observation period.
[4] Tim Dierks and Eric Rescorla. The Transport Layer Security (TLS) Protocol Version 1.2. RFC 5246, RFC Editor, August 2008.
[5] Donald Eastlake 3rd. Transport Layer Security (TLS) Extensions: Extension Definitions. RFC 6066, RFC Editor, January 2011.
[6] Eric Rescorla. The Transport Layer Security (TLS) Protocol Version 1.3. RFC 9846, RFC Editor, July 2026.
[7] Eric Rescorla, Kazuho Oku, Nick Sullivan, and Christopher A. Wood. TLS Encrypted Client Hello. RFC 9849, RFC Editor, March 2026.
[8] Martin Thomson and Sean Turner. Using TLS to Secure QUIC. RFC 9001, RFC Editor, May 2021.
[9] Mirja Kühlewind and Brian Trammell. Manageability of the QUIC Transport Protocol. RFC 9312, RFC Editor, September 2022.
[10] Vincent F Taylor, Riccardo Spolaor, Mauro Conti, and Ivan Marti-novic. AppScanner: Automatic fingerprinting of smartphone apps from encrypted network traffic. In 2016 IEEE European Symposium on Security and Privacy (EuroS&P), pages 439–454. IEEE, 2016.
[11] Khaled Al-Naami, Swarup Chandra, Ahmad Mustafa, Latifur Khan, Zhiqiang Lin, Kevin Hamlen, and Bhavani Thuraisingham. Adaptive encrypted traffic fingerprinting with bi-directional dependence. In Proceedings of the 32nd Annual Conference on Computer Security Applications, pages 177–188, 2016.
[12] Mohammad Lotfollahi, Mahdi Jafari Siavoshani, Ramin Shirali Hossein Zade, and Mohammadsadegh Saberian. Deep Packet: A novel approach for encrypted traffic classification using deep learning. Soft Computing, 24(3):1999–2012, 2020.
[13] Chang Liu, Longtao He, Gang Xiong, Zigang Cao, and Zhen Li. FS-Net: A flow sequence network for encrypted traffic classification. In IEEE INFOCOM 2019 – IEEE Conference on Computer Communications, pages 1171–1179. IEEE, 2019.
[14] Payap Sirinam, Mohsen Imani, Marc Juarez, and Matthew Wright. Deep Fingerprinting: Undermining website fingerprinting defenses with deep learning. In Proceedings of the 2018 ACM SIGSAC Conference on Computer and Communications Security, pages 1928–1943, 2018.
[15] Xinjie Lin, Gang Xiong, Gaopeng Gou, Zhen Li, Junzheng Shi, and Jing Yu. ET-BERT: A contextualized datagram representation with pre-training transformers for encrypted traffic classification. In Proceedings of the ACM Web Conference 2022, pages 633–642, 2022.
Tong Guan et al.: Preprint submitted to Elsevier
Page 15 of 19
[16] Zijun Hang, Yuliang Lu, Yongjie Wang, and Yi Xie. Flow-MAE: Leveraging masked autoencoder for accurate, efficient and robust malicious traffic classification. In Proceedings of the 26th International Symposium on Research in Attacks, Intrusions and Defenses, pages 297–314, 2023.
[17] Xuying Meng, Chungang Lin, Yequan Wang, and Yujun Zhang. NetGPT: Generative pretrained transformer for network traffic. arXiv preprint arXiv:2304.09513, 2023.
[18] Guangmeng Zhou, Xiongwen Guo, Zhuotao Liu, Tong Li, Qi Li, and Ke Xu. TrafficFormer: an efficient pre-trained model for traffic data. In 2025 IEEE Symposium on Security and Privacy (SP), pages 1844–1860. IEEE, 2025.
[19] Nimesha Wickramasinghe, Arash Shaghaghi, Gene Tsudik, and Sanjay Jha. SoK: Decoding the enigma of encrypted network traffic classifiers. In 2025 IEEE Symposium on Security and Privacy (SP), pages 1825–1843. IEEE, 2025.
[20] Barak Gahtan, Robert J Shahla, Alex M Bronstein, and Reuven Cohen. Exploring QUIC dynamics: A large-scale dataset for encrypted traffic analysis. arXiv preprint arXiv:2410.03728, 2024.
[21] Andriy Panchenko, Fabian Lanze, Jan Pennekamp, Thomas Engel, Andreas Zinnen, Martin Henze, and Klaus Wehrle. Website fingerprinting at Internet scale. In Proceedings of the Network and Distributed System Security Symposium (NDSS), 2016.
[22] Wei Wang, Ming Zhu, Jinlin Wang, Xuewen Zeng, and Zhongzhen Yang. End-to-end encrypted traffic classification with one-dimensional convolution neural networks. In 2017 IEEE International Conference on Intelligence and Security Informatics (ISI), pages 43–48. IEEE, 2017.
[23] Wei Wang, Ming Zhu, Xuewen Zeng, Xiaozhou Ye, and Yiqiang Sheng. Malware traffic classification using convolutional neural network for representation learning. In 2017 International Conference on Information Networking (ICOIN), pages 712–717. IEEE, 2017.
[24] Kevin Fauvel, Fuxing Chen, and Dario Rossi. A lightweight, efficient and explainable-by-design convolutional neural network for Internet traffic classification. In Proceedings of the 29th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, pages 4013–4023, 2023.
[25] Meng Shen, Jinpeng Zhang, Liehuang Zhu, Ke Xu, and Xiaojiang Du. Accurate decentralized application identification via encrypted traffic analysis using graph neural networks. IEEE Transactions on Information Forensics and Security, 16:2367–2380, 2021.
[26] Hong Ye He, Zhi Guo Yang, and Xiang Ning Chen. PERT: Pay-load encoding representation from transformer for encrypted traffic classification. In 2020 ITU Kaleidoscope: Industry-Driven Digital Transformation (ITU K), pages 1–8. IEEE, 2020.
[27] Peng Lin, Yishen Hu, Yanying Lin, Kejiang Ye, and Cheng-Zhong Xu. PEAN: A packet-level end-to-end attentive network for encrypted traffic identification. In 2021 IEEE 23rd Int Conf on High Performance Computing & Communications; 7th Int Conf on Data Science & Systems; 19th Int Conf on Smart City; 7th Int Conf on Dependability in Sensor, Cloud & Big Data Systems & Application (HPCC/DSS/SmartCity/DependSys), pages 267–274. IEEE, 2021.
[28] Xinjie Lin, Longtao He, Gaopeng Gou, Jing Yu, Zhong Guan, Xiang Li, Juncheng Guo, and Gang Xiong. CETP: A novel semi-supervised framework based on contrastive pre-training for imbalanced encrypted traffic classification. Computers & Security, 143:103892, 2024.
[29] Lingfeng Peng, Xiaohui Xie, Sijiang Huang, Ziyi Wang, and Yong Cui. PTU: Pre-trained model for network traffic understanding. In 2024 IEEE 32nd International Conference on Network Protocols (ICNP), pages 1–12. IEEE, 2024.
[30] Xu-Yang Chen, Lu Han, De-Chuan Zhan, and Han-Jia Ye. MI-ETT: Multi-instance encrypted traffic transformer for encrypted traffic classification. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 39, pages 15922–15929, 2025.
[31] Luming Yang, Lin Liu, Junjie Huang, Zhuotao Liu, Shiyu Liang, Shaojing Fu, and Yongjun Wang. MM4flow: A pre-trained multi-modal model for versatile network traffic analysis. In Proceedings of
the 2025 ACM SIGSAC Conference on Computer and Communications Security, pages 1664–1678, 2025.
[32] Ruijie Zhao, Mingwei Zhan, Xianwen Deng, Yanhao Wang, Yijun Wang, Guan Gui, and Zhi Xue. Yet another traffic classifier: A masked autoencoder based traffic transformer with multi-level flow representation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 37, pages 5420–5427, 2023.
[33] Tongze Wang, Xiaohui Xie, Wenduo Wang, Chuyi Wang, Youjian Zhao, and Yong Cui. NetMamba: Efficient network traffic classification via pre-training unidirectional Mamba. In 2024 IEEE 32nd International Conference on Network Protocols (ICNP), pages 1–11. IEEE, 2024.
[34] Zijia Song, Zhengyi Ma, Qiming Yu, Xiaohui Xie, Yelin Wang, and Guozheng Yang. PaT: An enhanced pretrained framework via Mamba-2 for network traffic analysis. Computer Networks, page 112307, 2026.
[35] Jee-Tae Park, Yang-Seo Choi, Bu-Seung Cho, Seung-Hae Kim, and Myung-Sup Kim. Multi-level pre-training for encrypted network traffic classification. IEEE Access, 13:68643–68659, 2025.
[36] Scapy Community. Scapy: Packet manipulation program and library. https://scapy.net/, 2024. Version 2.6.1, accessed July 2026.
[37] Gerard Draper-Gil, Arash Habibi Lashkari, Mohammad Saiful Islam Mamun, and Ali A Ghorbani. Characterization of encrypted and VPN traffic using time-related features. In Proceedings of the 2nd International Conference on Information Systems Security and Privacy (ICISSP), pages 407–414, 2016.
[38] Mohammadreza MontazeriShatoori, Logan Davidson, Gurdip Kaur, and Arash Habibi Lashkari. 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), pages 63–70. IEEE, 2020.
[39] Sajjad Dadkhah, Hassan Mahdikhani, Priscilla Kyei Danso, Alireza Zohourian, Kevin Anh Truong, and Ali A Ghorbani. Towards the development of a realistic multidimensional IoT profiling dataset. In 2022 19th Annual International Conference on Privacy, Security & Trust (PST), pages 1–11. IEEE, 2022.
[40] Nour Moustafa. A new distributed architecture for evaluating AI-based security systems at the edge: Network TON_IoT datasets. Sustainable Cities and Society, 72:102994, 2021.
[41] Luming Yang, Lin Liu, Jun-jie Huang, Jiangyong Shi, Shaojing Fu, Yongjun Wang, and Jinshu Su. Robustness matters: Pre-training can enhance the performance of encrypted traffic analysis. IEEE Transactions on Information Forensics and Security, 2025.
[42] Yuqi Zhao, Giovanni Dettori, Matteo Boffa, Luca Vassio, and Marco Mellia. The sweet danger of sugar: Debunking representation learning for encrypted traffic classification. In Proceedings of the ACM SIGCOMM 2025 Conference, pages 296–310, 2025.
[43] Lukáš Jančička, Dominik Soukup, Josef Koumar, Filip Némec, and Tomáš Čejka. MFWDD: Model-based feature weight drift detection showcased on TLS and QUIC traffic. In 2024 20th International Conference on Network and Service Management (CNSM), pages 1–5. IEEE, 2024.
[44] Jan Luxemburk, Karel Hynek, Tomáš Čejka, Andrej Lukačovič, and Pavel Šiška. CESNET-QUIC22: A large one-month QUIC network traffic dataset from backbone lines. Data in Brief, 46:108888, 2023.
[45] Karel Hynek, Jan Luxemburk, Jaroslav Pešek, Tomáš Čejka, and Pavel Šiška. CESNET-TLS-Year22: A year-spanning TLS network traffic dataset from backbone lines. Scientific Data, 11(1):1156, 2024.
[46] Jan Luxemburk and Tomáš Čejka. Fine-grained TLS services classification with reject option. Computer Networks, 220:109467, 2023.
[47] Jan Luxemburk, Karel Hynek, and Jonas Mücke. CESNET-QUICEXT-25: A year-long QUIC traffic dataset with EXTended attributes. Zenodo, 2025. Dataset, version 1.
Tong Guan et al.: Preprint submitted to Elsevier
Page 16 of 19
A. Field Parsing Statistics
Parsing statistics are computed on the model input after applying the per-flow packet limit and the per-packet byte budget , with packets parsed individually without TCP reassembly. Field-token coverage is the ratio of field tokens to the sum of field tokens and 2-byte fallback tokens. Encrypted TLS record bodies, encrypted QUIC payloads and protected header fields, and variable-length TCP options are retained as 2-byte tokens and therefore lower the coverage.
As shown in Table 9, all capture files are read successfully, no packet raises a decoding error or yields malformed fields, and the IP and TCP/UDP header fields are parsed for every packet. QUIC public headers are parsed for all packets on VisQUIC; the unparsed QUIC packets on CIC-IoT-2022 are legacy gQUIC packets without explicit version identifiers, which are retained as 2-byte tokens rather than parsed with guessed field boundaries.
To evaluate TLS parsing independently of the parser, we reconstruct the TCP byte stream of each direction by sequence number and identify TLS record boundaries by requiring at least three consecutive valid records chained by their length fields. This reconstruction is used only for the audit. As shown in Table 10, 99.74% of the record headers within the retained bytes are parsed in the downstream datasets, and only 6 of about 2.27 million parsed record headers are false positives. Record coverage is lower, at 50.56%, because nearly all of the remaining record headers begin within a segment beyond the 80-byte budget, and thus fall outside the model input by design rather than being missed by the parser.
To examine parsing under real-world conditions, which may involve non-standard implementations, fragmentation, out-of-order delivery, and truncation, we apply the same procedure to traffic collected from a campus network, comprising 58,431 eligible flows from 102 application categories. As shown in the last rows of Tables 9 and 10, the IP and TCP/UDP header fields are again parsed for every packet, the overall field-token coverage is 62.67%, and the parser recall of TLS record headers within the retained bytes is 99.62% with no false positives.
B. Generalization Evaluation
B.1. Cipher-Suite Shift and Network Perturbations
Cipher-suite shift. We train FLARE on CipherSpectrum traffic encrypted with AES-128-GCM and test it on traffic encrypted with AES-256-GCM, ChaCha20-Poly1305 and on a mixed set, with the in-distribution AES-128-GCM test set as a reference. As shown in Table 11, accuracy decreases from 98.61% to 64.24%, 71.28% and 77.46%, respectively. A change of cipher suite therefore introduces a distribution shift, although accuracy remains well above the chance level.
Network perturbations. To approximate changes in network conditions, we perturb only the test flows

(a) Packet loss
(b) Packet retransmission
Figure 7: Accuracy of FLARE under test-time network perturbations on CipherSpectrum-mix and CSTNET-TLS 1.3. (a) Each packet is dropped independently with probability . (b) Each packet is followed by an identical copy with probability .
of CipherSpectrum-mix and CSTNET-TLS 1.3, leaving the trained model unchanged. For packet loss, each packet is dropped independently with probability ; for retransmission, each packet is followed by an identical copy with probability . In both cases, the first 64 packets of the perturbed flow are used as input, and . As shown in Figure 7, FLARE is robust to retransmission, with accuracy decreasing by at most 1.46 percentage points even at , since duplicated packets preserve the original packets and their order. Packet loss has a larger effect, as it removes packets and shifts the positions of subsequent ones. Accuracy decreases by up to 9.56 and 6.24 percentage points on the two datasets at a loss rate of 20%, but by only 2.15 and 0.80 percentage points at 5%.
B.2. Metadata-Only ISP Traffic
The datasets in the main experiments provide raw packets but cover limited periods and moderate numbers of classes. Large-scale deployments such as ISP backbone networks must additionally cope with long-term traffic evolution and much larger service sets, often with only flow-level metadata retained. We therefore evaluate FLARE on the CESNET DataZoo datasets, captured on an ISP backbone network over periods of up to one year. Since only flow-level metadata is available, PacketEncoder cannot be applied, and FLARE uses the directional packet-length representation alone. These evaluations thus examine the sequential representation of FLARE under temporal drift and class-space scaling.
B.2.1. Temporal Drift
Following the MFWDD study [43], we use CESNET-QUIC22 [44] and CESNET-TLS-Year22 [45] for the temporal drift evaluation. We selected 10 service classes, sampled 500 flows per class, and split the data into training and test sets by time.
Table 12 reports the short-term drift results. On CESNET-QUIC22, macro-F1 decreases by a cumulative 10.14 percentage points over three weeks, whereas CESNET-TLS-Year22 shows no noticeable decline over the same period.
Tong Guan et al.: Preprint submitted to Elsevier
Page 17 of 19
Table 9 Field parsing statistics.
| Dataset | Packets | IP & TCP/UDP headers parsed | QUIC headers parsed | TLS field-token coverage | Overall field-token coverage |
|---|---|---|---|---|---|
| ISCX-NonVPN | 13,835 | 100.00% | - | 14.74% | 46.07% |
| CIC-IoT-2022-Attacks | 15,373 | 100.00% | - | - | 47.90% |
| DoH-Malicious | 1,636,486 | 100.00% | - | 21.26% | 63.29% |
| CSTNET-TLS 1.3 | 212,028 | 100.00% | - | 9.34% | 51.63% |
| ISCX-VPN-Service | 78,586 | 100.00% | - | 13.69% | 48.52% |
| ISCX-VPN-App | 72,371 | 100.00% | - | 12.86% | 48.26% |
| UNSW-TON-IoT | 72,066 | 100.00% | - | 16.06% | 46.34% |
| USTC-TFC | 2,327,218 | 100.00% | - | 6.48% | 46.88% |
| CIC-IoT-2022 | 48,208 | 100.00% | 34.18% | 14.77% | 49.33% |
| CipherSpectrum-mix | 1,023,452 | 100.00% | - | 9.79% | 52.52% |
| VisQUIC | 482,922 | 100.00% | 100.00% | - | 37.84% |
| Dataset total | 7,340,578 | 100.00% | 99.74% | 9.83% | 49.65% |
| Campus network | 1,257,844 | 100.00% | - | 16.26% | 62.67% |
Table 10 Independent audit of TLS record-header parsing.
| Dataset | Parser recall | False positives | Record coverage | Payload-start visibility |
|---|---|---|---|---|
| ISCX-NonVPN | 99.94% | 0.00% | 75.95% | 73.07% |
| DoH-Malicious | 100.00% | 0.00% | 88.01% | 94.99% |
| CSTNET-TLS 1.3 | 99.03% | 0.00% | 64.41% | 50.94% |
| ISCX-VPN-Service | 99.98% | 0.02% | 77.39% | 61.58% |
| ISCX-VPN-App | 99.98% | 0.02% | 77.55% | 58.52% |
| UNSW-TON-IoT | 99.71% | 0.00% | 65.40% | 65.31% |
| USTC-TFC | 99.30% | 0.00% | 52.73% | 26.93% |
| CIC-IoT-2022 | 99.73% | 0.00% | 75.53% | 60.23% |
| CipherSpectrum-mix | 99.76% | 0.00% | 49.50% | 57.69% |
| Dataset total | 99.74% | 0.0003% | 50.56% | 57.06% |
| Campus network | 99.62% | 0.00% | 60.37% | 59.51% |
Parser recall is the proportion of record headers within the retained bytes that are parsed; record coverage is the proportion of all record headers carried by the retained packets that are parsed; payload-start visibility is the proportion of payload-bearing TLS packets whose payload begins with a record header.
Table 11 Cross-cipher-suite evaluation on CipherSpectrum.
| Test Setting | Test suite | Acc | F1 |
|---|---|---|---|
| In-distribution | AES-128-GCM | 0.9861 | 0.9862 |
| Cross-suite | AES-256-GCM | 0.6424 | 0.6540 |
| Cross-suite | ChaCha20-Poly1305 | 0.7128 | 0.6996 |
| Cross-suite | Mix | 0.7746 | 0.7760 |
The long-term drift results are reported in Table 13 and Figure 8. When trained on week W-2022-02 of CESNET-TLS-Year22, FLARE degrades gradually and still achieves a macro-F1 of 75.16% after nearly one year.
B.2.2. Class-Space Scaling
To examine how FLARE performs on a large public dataset, we conducted class-scaling experiments on four CESNET DataZoo datasets: CESNET-QUIC22 [44], CESNET-TLS-Year22 [45], CESNET-TLS22 [46], and

Figure 8: Weekly macro-F1 of FLARE under temporal drift on CESNET-TLS-Year22.
CESNET-QUICEXT-25 [47]. Each dataset was fixed to a single collection period, namely W-2022-44, W-2022-02, W-2021-40, and M-2025-1, respectively. As in the temporal drift evaluation, FLARE uses the directional packet-length pathway alone, taking the signed lengths of the first 30 packets of each flow as input. To exclude the effect of class imbalance, we sampled 1,000 flows per class and split them 8:1:1 into training, validation, and test sets. Class subsets were taken as prefixes of a single random permutation, so that each smaller subset is contained in every larger one, and the number of classes was increased from 10 to the full class set of each dataset.
The results are shown in Figure 9. As the number of classes increases, the accuracy of FLARE declines steadily without abrupt drops. When expanding from 10 classes to the full class set, accuracy decreases by 4.63 percentage points on CESNET-TLS-Year22 (175 classes), 3.28 percentage points on CESNET-TLS22 (186 classes), and 1.94 percentage points on CESNET-QUICEXT-25 (47 classes). CESNET-QUIC22 is more sensitive to class-space growth, with accuracy falling from 94.70% to 82.52%, a drop of 12.18 percentage points. The slight increases between some
Tong Guan et al.: Preprint submitted to Elsevier
Page 18 of 19
Table 12
Short-term drift evaluation on CESNET-QUIC22 and CESNET-TLS-Year22. Values are macro-F1 (%). Changes relative to the in-period result are given in parentheses (pp).
| Dataset | Classes | Train week | +0 week | +1 week | +2 weeks | +3 weeks |
|---|---|---|---|---|---|---|
| CESNET-QUIC22 | 10 | W-2022-44 | 85.27 | 80.96 (-4.31) | 75.34 (-9.93) | 75.13 (-10.14) |
| CESNET-TLS-Year22 | 10 | W-2022-02 | 95.40 | 95.96 (+0.56) | 95.77 (+0.37) | 96.28 (+0.88) |
Table 13
Long-term drift evaluation on CESNET-TLS-Year22. Δ denotes the change in macro-F1 relative to the in-period result.
| Week | Gap (weeks) | Acc | F1 | Δ F1 (pp) |
|---|---|---|---|---|
| W-2022-02 | 0 | 0.9540 | 0.9540 | 0.00 |
| W-2022-18 | 16 | 0.8749 | 0.8735 | -8.06 |
| W-2022-35 | 33 | 0.8000 | 0.7986 | -15.54 |
| W-2022-49 | 47 | 0.7561 | 0.7516 | -20.24 |

Figure 9: Accuracy of FLARE with an increasing number of classes on four CESNET datasets.
adjacent settings, such as from 30 to 40 classes on CESNET-QUICEXT-25 and from 100 to 102 classes on CESNET-QUIC22, arise from variation across independently trained models and do not alter the overall downward trend. These results indicate that directional packet-length sequences remain discriminative on real ISP traffic with more than one hundred service classes.
Tong Guan et al.: Preprint submitted to Elsevier
Page 19 of 19