lens-generalization / README.md
Charles59's picture
Update paper citation to published TMLR version (li2026lens)
2b0c710 verified
|
Raw
History Blame Contribute Delete
4.43 kB
---
license: cc-by-nc-4.0
library_name: transformers
base_model: google/t5-v1_1-base
tags:
- network-traffic
- classification
- generalization
- few-shot
- foundation-model
- t5
datasets:
- Charles59/lens-network-traffic
---
# Lens — Generalization (Extend-to-New-Classes) Base Checkpoints
Stage-1 **base** checkpoints for **Lens**'s extensibility experiment (a knowledge-guided
foundation model for network traffic, TMLR) — paper **Table 5**. They let you reproduce
Table 5 without re-running the ~6 h base fine-tune.
> ⚠️ Archival / reproduction artifacts; this card documents how to use these checkpoints.
## What these are
The extensibility setting asks how well the model extends classification to **N new (unseen)
classes** (N = 1, 3, 5). It is two-stage:
1. **Stage 1 (base, these checkpoints):** fine-tune on the task with the top-N most
train-frequent classes **held out** (excluded from training and the prompt label space).
2. **Stage 2 (extend):** resume a base checkpoint, add the N new classes to the prompt, and
fine-tune on the new-class data; test on the full set (old + new).
Each file here is a Stage-1 base model (`model.safetensors`, ~945 MB; optimizer state is not
included — Stage 2 uses a fresh optimizer).
## Layout
```
crossplatform_android_app_classification/ # paper Task 6 (209 classes)
new1/model.safetensors # held out top-1 frequent class
new3/model.safetensors # held out top-3
new5/model.safetensors # held out top-5
crossplatform_ios_app_classification/ # paper Task 8 (196 classes)
new1/model.safetensors
new3/model.safetensors
new5/model.safetensors
```
**Held-out (new) classes = the most train-frequent classes, in rank order:**
- **iOS (Task 8):** `132 pocket-pool`, `5 aiqiyi`, `26 color-ballz`, `193 yy`, `191 youku`
(new1 = {132}; new3 = first 3; new5 = all 5)
- **Android (Task 6):** `71 com.ifeng.news2`, `134 com.sohu.sohuvideo`,
`173 com.xunlei.downloadprovider`, `116 com.qiyi.video`, `177 com.youku.phone`
## Paper Table 5 (reproduced)
| Scenario | Task 6 / Android AC↑ / F1↑ | Task 8 / iOS AC↑ / F1↑ |
|---|---|---|
| 1 new | 0.9565 / 0.8578 | 0.9397 / 0.8861 |
| 3 new | 0.9518 / 0.8659 | 0.8962 / 0.8801 |
| 5 new | 0.9199 / 0.8264 | 0.8730 / 0.8407 |
## Reproduce (resume a base checkpoint + run Stage-2 extension)
```python
from huggingface_hub import hf_hub_download
base = hf_hub_download("Charles59/lens-generalization",
"crossplatform_ios_app_classification/new1/model.safetensors")
```
```bash
# from the Lens code repo (HF-native; held-out set derived deterministically as top-N)
STAGE1_CKPT=$base ./scripts/generalization/stage2_continue_finetune.sh \
CrossPlatform_IOS_APP_Classification 1 # task, num_new_classes (k_shot defaults to all)
# -> paper Table 5, Task 8, 1 new: accuracy ~0.9397, macro-f1 ~0.8861 (best epoch)
```
Swap the task / `num_new_classes` (1 / 3 / 5) and the base checkpoint per the table. See
`docs/REPRODUCE_table5.md` in the code repo for the full mapping and the Android learning rates.
> Note: the Stage-1 base fine-tune is itself reproducible from the released pretrained model +
> data (`./scripts/generalization/stage1_run_generalization.sh`); these checkpoints just let you
> skip it. Exact numbers may vary by training hardware; the originals reproduce the table.
## Related
- Pretrained base: [Charles59/lens-pretrained](https://huggingface.co/Charles59/lens-pretrained)
- Classification checkpoints: [Charles59/lens-finetuned](https://huggingface.co/Charles59/lens-finetuned)
- Generation checkpoints: [Charles59/lens-finetuned-generation](https://huggingface.co/Charles59/lens-finetuned-generation)
- Data: [Charles59/lens-network-traffic](https://huggingface.co/datasets/Charles59/lens-network-traffic)
## Citation
```bibtex
@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}
}
```
## License
**CC-BY-NC-4.0**. Derived from academic datasets via NetBench (Qian et al., 2024); their original terms also apply.