Transformers
network-traffic
traffic-classification
network-security
foundation-model
t5

Lens — Fine-tuned Classification Checkpoints

Per-task fine-tuned checkpoints of Lens (a knowledge-guided foundation model for network traffic, TMLR) for the 12 downstream classification tasks (paper Tables 2 & 3). Each checkpoint reproduces the paper's reported Accuracy / Macro-F1.

Layout

One subfolder per task, each a standalone HuggingFace model (pytorch_model.bin + config.json

  • tokenizer), loadable with T5ForConditionalGeneration.

Tasks (paper numbers, reproduced)

Task Config / subfolder #Cls Acc Macro-F1 Decode
1 vpn_detection 2 0.9942 0.9870 text
2 vpn_service_classification 6 0.8979 0.8893 text
3 vpn_application_classification 16 0.8406 0.8137 text
4 tor_service_detection 7 0.9692 0.8120 text
5 ustc-tfc2016_app_detection 16 0.9538 0.9676 text
6 crossplatform_android_app_classification 209 0.9660 0.8847 digit
7 crossplatform_android_app_country_detection 3 0.9960 0.9898 text
8 crossplatform_ios_app_classification 196 0.9752 0.9492 digit
9 crossplatform_ios_app_country_detection 3 0.9951 0.9951 text
10 dohbrw_query_generator_detection 5 0.9963 0.9610 text
11 iot_malicious_detection 2 0.9877 0.9870 text
12 iot_method_detection 7 0.9878 0.6802 text

Decode column: all tasks use the single script finetune_classification.py. text tasks generate the class-name string (label_format: label_string, config cls); digit tasks (≥100 classes) generate the numeric class index (label_format: digit, config cls_digit), as described in the paper. Every checkpoint was verified to reproduce its row via the test commands below.

Reproduce a result

from huggingface_hub import hf_hub_download
ckpt = hf_hub_download("Charles59/lens-finetuned", "vpn_detection/pytorch_model.bin")

Text tasks (all except Tasks 6 & 8):

python scripts/finetune_classification.py \
  mode=finetune_test \
  data.hf_repo=Charles59/lens-network-traffic data.hf_config=vpn_detection \
  task_args.name=VPN_Detection \
  model_args.pretrained_checkpoint=<ckpt>
# -> accuracy: 0.9942, macro-f1: 0.9870

Digit tasks (Task 6 crossplatform_android_app_classification, Task 8 crossplatform_ios_app_classification) use the same script with --config-name=cls_digit:

python scripts/finetune_classification.py --config-name=cls_digit \
  mode=finetune_test \
  data.hf_repo=Charles59/lens-network-traffic data.hf_config=crossplatform_android_app_classification \
  task_args.name=CrossPlatform_Android_APP_Classification \
  model_args.pretrained_checkpoint=<ckpt>

data.hf_config = the subfolder name; task_args.name = the original task name (see the table; e.g. vpn_detection ↔ VPN_Detection).

Notes

  • Task 12 (iot_method_detection) was re-finetuned (30 epochs) to recover a lost checkpoint; it reproduces the paper (Acc 0.9897 / Macro-F1 0.6813 vs. paper 0.9878 / 0.6802).
  • Macro-F1 for highly imbalanced tasks (e.g. Task 12, 7 classes) is sensitive; report both Acc and Macro-F1.

Related

License

CC-BY-NC-4.0. Derived from academic datasets via NetBench (Qian et al., 2024); their original terms also apply.

Citation

@article{li2026lens,
  title   = {Lens: A Knowledge-Guided Foundation Model for Network Traffic},
  author  = {Li, Xiaochang and Qian, Chen and Wang, Qineng and Kong, Jiangtao and Wang, Yuchen and Yao, Ziyu and Ji, Bo and Cheng, Long and Zhou, Gang and Shao, Huajie},
  journal = {Transactions on Machine Learning Research},
  issn    = {2835-8856},
  year    = {2026},
  url     = {https://openreview.net/forum?id=cGDwTgnJIR},
  note    = {arXiv:2402.03646}
}
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Charles59/lens-finetuned

Finetuned
(59)
this model

Dataset used to train Charles59/lens-finetuned

Paper for Charles59/lens-finetuned