TrafficInstruct: A Multi-Task Network Traffic Dataset and Benchmark for Instruction Tuning
Organizations: School of Cyberspace Security, University of Science and Technology of China, Hefei, China
Abstract
Instruction tuning for multi-task network traffic analysis requires data with clearly defined sources, supervision targets, and evaluation conditions. We introduce TrafficInstruct, a newly collected dataset comprising raw packet captures and 55,000 structured supervised fine-tuning records across ten tasks: malware traffic detection, botnet detection, malicious DNS-over-HTTPS detection, Web attack detection, advanced persistent threat detection, encrypted VPN detection, Tor behavior detection, encrypted application/service classification, website fingerprinting, and application classification under concept drift. An automated workflow captures traffic from controlled software executions, attack experiments, and application activities. Labels are supported by task-specific collection evidence, including process or socket attribution, activity records, and execution outcomes. Filtering, sanitization, and task-specific transformations produce instructions, traffic observations, and structured answers. We verify sample sources and partition the dataset by complete collection sessions, keeping all samples from the same session within one partition. The benchmark defines allowed inputs, deterministic label mappings, fixed training/validation/test partitions, and task-wise scoring rules. We evaluate majority-class, random-forest, and ET-BERT baselines, an unadapted 27B language model, and independently trained task-specific LoRA adapters on a shared frozen base. Adapters are selected using validation data and evaluated on the corresponding test sets. Task-specific adaptation improves classification performance, supporting instruction tuning across diverse traffic-analysis tasks.
Figures & tables
| Resource | Data source | Task coverage | Representation / granularity | Instruction resources | Reported partition unit |
| NetBench [ 2 ] | Seven public datasets | Classification and generation | Flows and packets | NR | PCAP before extraction (Sec. 3.1) |
| TrafficLLM [ 1 ] | Public traffic datasets | Ten analysis scenarios | Traffic token sequences | Yes | 8:1:1 ratio; source groups NR in Sec. IV-A |
| CTU-13 [ 9 ] | Botnet capture scenarios | Botnet / normal / background | Labeled flows; activity aggregates | NR | Scenarios in the BClus experiment (Sec. 6.2.2) |
| cAPTure [ 10 ] | Attack executions and replayed background | Multi-stage APT detection | Packets with attack-step labels | NR | Independent executions and background days (Sec. 4.3) |
| Task | Abbrev. | Observation | Description | Level 1 / native | Level 2 |
|---|---|---|---|---|---|
| Malware Traffic Detection | MTD | Connection | Detect malware traffic and identify the malware family. | Benign / malicious (2) | Benign + families (11) |
| Botnet Detection | BND | Flow | Distinguish botnet traffic from normal traffic and identify its family. | Normal / Botnet (2) | Normal + five families (6) |
| Malicious DoH Detection | MDD | Flow statistics | Identify malicious DNS-over-HTTPS traffic and its behavior category. | Non-DoH / benign / malicious (3) | Non-DoH + benign + behaviors (14) |
| Web Attack Detection | WAD | Flow | Detect Web attack attempts and identify the attack category. | Benign / attack (2) | Benign + attack categories (9) |
| APT Attack Detection | AAD | Flow segment | Classify traffic from controlled APT experiments as benign or malicious. | Benign / malicious (2) | — |
| Encrypted VPN Detection | EVD | Flow | Recognize VPN traffic and classify the associated network activity. | Normal / VPN (2) | Activity categories (18) |
| Task | Maximum sequence length (tokens) |
|---|---|
| MTD | 4096 |
| BND | 4096 |
| MDD | 4096 |
| WAD-Plain | 8192 |
| WAD-Enc | 8192 |
| AAD | 1024 |
| Majority class | Random forest | ET-BERT | Qwen3.8 27B base | Qwen3.8 27B + task LoRA | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Task | Acc. | Macro-F1 | Acc. | Macro-F1 | Acc. | Macro-F1 | Acc. | Macro-F1 | Acc. | Macro-F1 |
| MTD | 50.0 | 33.3 | 89.2 | 89.1 | 92.6 | 92.6 | 60.9 | 53.8 | 93.5 | 93.5 |
| BND | 50.0 | 33.3 | 91.3 | 88.1 | 96.5 | 96.5 | 61.0 | 54.3 | 98.8 | 98.1 |
| MDD | 33.3 | 16.7 | 92.1 | 90.8 | 97.5 | 97.5 | 53.2 | 47.7 | 97.8 | 97.4 |
| WAD-Plain | 50.5 | 33.6 | 89.2 | 89.2 | 92.2 | 92.2 | 87.8 | 87.7 | 100.0 | 100.0 |
| WAD-Enc | 50.5 | 33.6 | 86.4 | 85.9 | 86.8 | 86.8 | 50.5 | 33.6 | 94.4 | 94.4 |
| Majority class | Random forest | ET-BERT | Qwen3.8 27B base | Qwen3.8 27B + task LoRA | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Task | Acc. | Macro-F1 | Acc. | Macro-F1 | Acc. | Macro-F1 | Acc. | Macro-F1 | Acc. | Macro-F1 |
| MTD | 50.0 | 6.1 | 70.9 | 59.6 | 78.0 | 62.3 | 51.3 | 8.4 | 74.0 | 52.7 |
| BND | 50.0 | 11.1 | 87.5 | 81.0 | 94.0 | 85.1 | 56.6 | 18.7 | 96.5 | 86.2 |
| MDD | 33.3 | 3.6 | 73.3 | 46.5 | 78.9 | 43.4 | 33.3 | 3.8 | 78.9 | 52.5 |
| WAD-Plain | 50.5 | 7.5 | 75.8 | 59.7 | 78.8 | 61.0 | 86.9 | 88.3 | 99.7 | 99.3 |
| WAD-Enc | 50.5 | 7.5 | 72.4 | 62.7 | 76.1 | 62.1 | 50.5 | 7.5 | 88.6 | 80.3 |
Appendix figures & tables11 assets
Supplementary material from the paper’s appendix.
Appendix
| Task | Model-answer fields | Main-score extraction |
|---|---|---|
| MTD | maliciousness , malware_family | Benign, or family when predicted malicious |
| BND | traffic_class , fine_label , botnet_family | fine_label |
| MDD | label , category | Coarse class for non-malicious cases; behavior category for malicious |
| WAD | label , category | category ; map none to benign |
| AAD | Derived label only | Benign/malicious from the scoped answer |
| EVD / TBD | label , category | category |
Cybersecurity
Cybersecurity develops methods to protect digital and cyber-physical systems from attacks, vulnerabilities, data loss, and misuse.
See all 370 papers