Label Unification for Cross-Dataset Generalization in Cybersecurity NER
Abstract
The field of cybersecurity NER lacks standard-ized labels, making it challenging to combine datasets. We investigate label unification across four cybersecurity datasets to increase data resource usability. We perform a coarse-grained label unification and conduct pairwise cross-dataset evaluations using RoBERTa models. Qualitative analysis of predictions reveals errors, limitations, and dataset differences. To address unification limitations, we propose alternative architectures including a multi-head model and a graph-based transfer model. Under our selected mapping and training setup, unified training underperformed the corresponding single-dataset baselines on all four development sets. The multi-head model with weight sharing provides no consistent benefits over single-dataset baselines, and the graph-based transfer model shows no consistent benefits.
Figures & tables
| Dataset | Original Labels | Unified Label |
|---|---|---|
| APTNER | APT, SECTEAM | Organization |
| OS | System | |
| VULNAME | Vulnerability | |
| MAL | Malware | |
| DNRTI | HackOrg, SecTeam, org | Organization |
| Tool | System |
| Sentence | APT32 actors continue to deliver the malicious attachments via spear-phishing emails. |
|---|---|
| labels A | B-Organization O O O O O B-Malware I-Malware O B-Vulnerability O O |
| labels B | B-Organization O O O O O O O O O |
| Component | Specification |
|---|---|
| Backbone | RoBERTa-base encoder |
| Token Classification Head | Linear layer on top of the encoder hidden states for token labels |
| Input Encoding | Tokenized word-level input with RoBERTa tokenizer; truncation to max length 512 |
| Label Alignment | Only the first subword of each token receives the true label; remaining subwords are masked |
| Hyperparameter | Value |
|---|---|
| Base Model | RoBERTa-base |
| Loss Function | CE (first token only) |
| Optimizer | AdamW |
| Learning Rate | 2e-5 |
| Batch Size | 2 |
| Epochs | 10 |
| Train \Dev | DNRTI | AttackER | APTNER | CyNER |
|---|---|---|---|---|
| DNRTI | 0.63 | 0.30 | 0.21 | 0.16 |
| AttackER | 0.34 | 0.61 | 0.26 | 0.37 |
| APTNER | 0.39 | 0.32 | 0.59 | 0.55 |
| CyNER | 0.25 | 0.24 | 0.32 | 0.73 |
| Train \Dev | DNRTI | AttackER | APTNER | CyNER |
|---|---|---|---|---|
| DNRTI | 0.63 | 0.29 | 0.15 | 0.13 |
| AttackER | 0.38 | 0.61 | 0.20 | 0.31 |
| APTNER | 0.48 | 0.40 | 0.51 | 0.58 |
| CyNER | 0.30 | 0.29 | 0.28 | 0.76 |
| Train \Dev | DNRTI | AttackER | APTNER | CyNER |
|---|---|---|---|---|
| DNRTI | 0.64 | 0.32 | 0.38 | 0.21 |
| AttackER | 0.32 | 0.62 | 0.40 | 0.45 |
| APTNER | 0.33 | 0.27 | 0.69 | 0.52 |
| CyNER | 0.22 | 0.21 | 0.37 | 0.71 |
| Train \Dev | DNRTI | AttackER | APTNER | CyNER |
|---|---|---|---|---|
| DNRTI | 0.71 | 0.43 | 0.37 | 0.44 |
| AttackER | 0.55 | 0.67 | 0.36 | 0.48 |
| APTNER | 0.55 | 0.45 | 0.66 | 0.60 |
| CyNER | 0.57 | 0.42 | 0.58 | 0.82 |
| Train \Dev | DNRTI | AttackER | APTNER | CyNER |
|---|---|---|---|---|
| DNRTI | 0.69 | 0.40 | 0.27 | 0.20 |
| AttackER | 0.44 | 0.69 | 0.39 | 0.48 |
| APTNER | 0.44 | 0.41 | 0.67 | 0.59 |
| CyNER | 0.29 | 0.38 | 0.35 | 0.78 |
| Datasets | DNRTI | AttackER | APTNER | CyNER |
|---|---|---|---|---|
| DNRTI | 0 | 0.23 | 0.04 | 0.05 |
| AttackER | 0.23 | 0 | 0.24 | 0.19 |
| APTNER | 0.04 | 0.24 | 0 | 0.07 |
| CyNER | 0.05 | 0.19 | 0.07 | 0 |
| Distribution | RoBERTa | p-value |
|---|---|---|
| Words | -0.02 | 0.95 |
| POS labels | -0.23 | 0.48 |
| Entity span lengths | 0.00 | 0.99 |
| Entity span-based counts | 0.13 | 0.68 |
| Dataset | Unified | Train-Only |
|---|---|---|
| Unified | 0.53 | - |
| DNRTI | 0.52 | 0.63 |
| AttackER | 0.51 | 0.61 |
| APTNER | 0.49 | 0.59 |
| CyNER | 0.67 | 0.73 |
| Dataset | Reference | Multi-head |
|---|---|---|
| DNRTI | 0.62 | 0.61 |
| AttackER | 0.43 | 0.42 |
| APTNER | 0.59 | 0.60 |
| CyNER | 0.77 | 0.80 |
| Dataset | Baseline (RoBERTa) | LST-NER (ours) |
|---|---|---|
| DNRTI | 0.72 | 0.70 ∗ |
| AttackER | 0.44 | 0.43 |
| APTNER | 0.51 | 0.48 ∗ |
| CyNER | 0.76 | 0.81 ∗ |
| Hyperparameter | Value |
|---|---|
| Learning rate | 5e-5 |
| Batch Size | 16 |
| Epochs | 3 |
| Max Length | 128 |
| Temp | 4 |
| Edge Threshold | 1.5 |
Appendix figures & tables2 assets
Supplementary material from the paper’s appendix.
Appendix
| Experiment | Training config |
|---|---|
| Cross-dataset | 1.09 GCD-h |
| unified | 1.15 GCD-h |
| Multi-head | 1.18 GCD-h |
| Dataset | GPU | GPU-hours |
|---|---|---|
| AttackER | RTX 2070 | 0.37 |
| APTNER | A30 | 0.93 |
| DNRTI | RTX 2070 | 0.68 |
| CyNER | RTX 6000 | 0.24 |
| Total | — | 2.22 |
Cross-Dataset Generalization
Cross-dataset generalization studies whether AI models retain accuracy, calibration, and usefulness on data from sources beyond their training set.
See all 142 papers