Sentence Similarity
Transformers
Safetensors
English
roberta
feature-extraction
security
vulnerability
mitre-attack
cve
bi-encoder
text-embeddings-inference
Instructions to use CIRCL/vulnerability-attack-technique-biencoder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CIRCL/vulnerability-attack-technique-biencoder with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("CIRCL/vulnerability-attack-technique-biencoder") model = AutoModel.from_pretrained("CIRCL/vulnerability-attack-technique-biencoder", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,199 +1,112 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
library_name: transformers
|
| 3 |
-
tags: []
|
| 4 |
---
|
| 5 |
|
| 6 |
-
#
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
-
|
| 23 |
-
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
[More Information Needed]
|
| 102 |
-
|
| 103 |
-
## Evaluation
|
| 104 |
-
|
| 105 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 106 |
-
|
| 107 |
-
### Testing Data, Factors & Metrics
|
| 108 |
-
|
| 109 |
-
#### Testing Data
|
| 110 |
-
|
| 111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
| 112 |
-
|
| 113 |
-
[More Information Needed]
|
| 114 |
-
|
| 115 |
-
#### Factors
|
| 116 |
-
|
| 117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 118 |
-
|
| 119 |
-
[More Information Needed]
|
| 120 |
-
|
| 121 |
-
#### Metrics
|
| 122 |
-
|
| 123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 124 |
-
|
| 125 |
-
[More Information Needed]
|
| 126 |
-
|
| 127 |
-
### Results
|
| 128 |
-
|
| 129 |
-
[More Information Needed]
|
| 130 |
-
|
| 131 |
-
#### Summary
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
## Model Examination [optional]
|
| 136 |
-
|
| 137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 138 |
-
|
| 139 |
-
[More Information Needed]
|
| 140 |
-
|
| 141 |
-
## Environmental Impact
|
| 142 |
-
|
| 143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 144 |
-
|
| 145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 146 |
-
|
| 147 |
-
- **Hardware Type:** [More Information Needed]
|
| 148 |
-
- **Hours used:** [More Information Needed]
|
| 149 |
-
- **Cloud Provider:** [More Information Needed]
|
| 150 |
-
- **Compute Region:** [More Information Needed]
|
| 151 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 152 |
-
|
| 153 |
-
## Technical Specifications [optional]
|
| 154 |
-
|
| 155 |
-
### Model Architecture and Objective
|
| 156 |
-
|
| 157 |
-
[More Information Needed]
|
| 158 |
-
|
| 159 |
-
### Compute Infrastructure
|
| 160 |
-
|
| 161 |
-
[More Information Needed]
|
| 162 |
-
|
| 163 |
-
#### Hardware
|
| 164 |
-
|
| 165 |
-
[More Information Needed]
|
| 166 |
-
|
| 167 |
-
#### Software
|
| 168 |
-
|
| 169 |
-
[More Information Needed]
|
| 170 |
-
|
| 171 |
-
## Citation [optional]
|
| 172 |
-
|
| 173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 174 |
-
|
| 175 |
-
**BibTeX:**
|
| 176 |
-
|
| 177 |
-
[More Information Needed]
|
| 178 |
-
|
| 179 |
-
**APA:**
|
| 180 |
-
|
| 181 |
-
[More Information Needed]
|
| 182 |
-
|
| 183 |
-
## Glossary [optional]
|
| 184 |
-
|
| 185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 186 |
-
|
| 187 |
-
[More Information Needed]
|
| 188 |
-
|
| 189 |
-
## More Information [optional]
|
| 190 |
-
|
| 191 |
-
[More Information Needed]
|
| 192 |
-
|
| 193 |
-
## Model Card Authors [optional]
|
| 194 |
-
|
| 195 |
-
[More Information Needed]
|
| 196 |
-
|
| 197 |
-
## Model Card Contact
|
| 198 |
-
|
| 199 |
-
[More Information Needed]
|
|
|
|
| 1 |
---
|
| 2 |
+
license: gpl-3.0
|
| 3 |
+
base_model: FacebookAI/roberta-base
|
| 4 |
+
datasets:
|
| 5 |
+
- CIRCL/vulnerability-attack-techniques
|
| 6 |
+
language:
|
| 7 |
+
- en
|
| 8 |
+
tags:
|
| 9 |
+
- security
|
| 10 |
+
- vulnerability
|
| 11 |
+
- mitre-attack
|
| 12 |
+
- cve
|
| 13 |
+
- bi-encoder
|
| 14 |
+
- sentence-similarity
|
| 15 |
library_name: transformers
|
|
|
|
| 16 |
---
|
| 17 |
|
| 18 |
+
# vulnerability-attack-technique-biencoder
|
| 19 |
+
|
| 20 |
+
A label-semantics bi-encoder that suggests MITRE ATT&CK (Enterprise)
|
| 21 |
+
techniques for a CVE by scoring the vulnerability description against the
|
| 22 |
+
**official ATT&CK technique descriptions** in a shared embedding space.
|
| 23 |
+
Unlike the companion classification head
|
| 24 |
+
([`CIRCL/vulnerability-attack-technique-classification-roberta-base`](https://huggingface.co/CIRCL/vulnerability-attack-technique-classification-roberta-base)),
|
| 25 |
+
it can rank *any* technique that has an official description — the label
|
| 26 |
+
is text, not a learned output row.
|
| 27 |
+
|
| 28 |
+
One shared `roberta-base` encoder embeds both the CVE text
|
| 29 |
+
(title + description) and each technique's STIX name+description
|
| 30 |
+
(citation markup stripped, 256 tokens), mean-pooled and L2-normalized;
|
| 31 |
+
the score is a learned affine over the cosine. Trained on the curated
|
| 32 |
+
gold set [`CIRCL/vulnerability-attack-techniques`](https://huggingface.co/datasets/CIRCL/vulnerability-attack-techniques)
|
| 33 |
+
(~1,200 CVEs, CTID methodology) with per-label-weighted BCE over a
|
| 34 |
+
53-parent-technique vocabulary, with VulnTrain
|
| 35 |
+
(`vulntrain-train-attack-biencoder`).
|
| 36 |
+
|
| 37 |
+
## When to use which model
|
| 38 |
+
|
| 39 |
+
- **Classification head**: best top-5 ranking on the trained vocabulary
|
| 40 |
+
(recall@5 0.667 ± 0.015 across five seeds).
|
| 41 |
+
- **This bi-encoder**: slightly lower recall@5 (0.643 ± 0.019) but the
|
| 42 |
+
largest consistent rare-technique gain measured on this task
|
| 43 |
+
(macro-F1 0.212 ± 0.011 vs 0.176 ± 0.016, +21% relative), and
|
| 44 |
+
open-vocabulary ranking over all 222 active parent techniques
|
| 45 |
+
(recall@5 0.515 ± 0.020, 2.3× a generic zero-shot sentence embedder).
|
| 46 |
+
|
| 47 |
+
Caveat measured in the accompanying paper: zero-shot ranking of
|
| 48 |
+
techniques *absent from training* does **not** benefit from this
|
| 49 |
+
fine-tuning — in a five-fold label-holdout evaluation the fine-tuned
|
| 50 |
+
encoder ranked held-out techniques below a generic MiniLM embedder.
|
| 51 |
+
Rankings for techniques outside the 53-technique training vocabulary
|
| 52 |
+
should be treated as no better than generic semantic similarity.
|
| 53 |
+
|
| 54 |
+
## Usage
|
| 55 |
+
|
| 56 |
+
The repository ships `technique_texts.json` (the exact technique texts
|
| 57 |
+
used at training time) and the scoring calibration in
|
| 58 |
+
`config.biencoder`:
|
| 59 |
+
|
| 60 |
+
```python
|
| 61 |
+
import json, torch
|
| 62 |
+
from huggingface_hub import hf_hub_download
|
| 63 |
+
from transformers import AutoModel, AutoTokenizer
|
| 64 |
+
|
| 65 |
+
model_id = "CIRCL/vulnerability-attack-technique-biencoder"
|
| 66 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 67 |
+
encoder = AutoModel.from_pretrained(model_id).eval()
|
| 68 |
+
cfg = encoder.config.biencoder
|
| 69 |
+
texts = json.load(open(hf_hub_download(model_id, "technique_texts.json")))
|
| 70 |
+
|
| 71 |
+
def embed(batch, max_length=512):
|
| 72 |
+
enc = tokenizer(batch, padding=True, truncation=True,
|
| 73 |
+
max_length=max_length, return_tensors="pt")
|
| 74 |
+
hidden = encoder(**enc).last_hidden_state
|
| 75 |
+
mask = enc["attention_mask"].unsqueeze(-1)
|
| 76 |
+
pooled = (hidden * mask).sum(1) / mask.sum(1)
|
| 77 |
+
return torch.nn.functional.normalize(pooled, dim=-1)
|
| 78 |
+
|
| 79 |
+
techniques = sorted(texts)
|
| 80 |
+
with torch.no_grad():
|
| 81 |
+
technique_emb = embed([texts[t] for t in techniques],
|
| 82 |
+
cfg["technique_max_length"])
|
| 83 |
+
cve_emb = embed(["Improper neutralization of special elements used "
|
| 84 |
+
"in an OS command in the web management interface..."])
|
| 85 |
+
scores = cfg["logit_scale"] * (cve_emb @ technique_emb.T) + cfg["logit_bias"]
|
| 86 |
+
for idx in scores[0].topk(5).indices:
|
| 87 |
+
print(techniques[idx], float(scores[0][idx]))
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
Evaluation and stratified breakdowns are reproducible with
|
| 91 |
+
`vulntrain-validate-attack-classification --method biencoder --model
|
| 92 |
+
CIRCL/vulnerability-attack-technique-biencoder` (add `--candidates full`
|
| 93 |
+
for open-vocabulary ranking over all active parent techniques).
|
| 94 |
+
|
| 95 |
+
## Intended use and limitations
|
| 96 |
+
|
| 97 |
+
The model generates **candidate techniques for analyst review**, not
|
| 98 |
+
authoritative mappings. Technique-to-CVE mapping involves analyst
|
| 99 |
+
judgment; the training labels inherit the CTID methodology's
|
| 100 |
+
subjectivity, and the gold set over-represents exploited and enriched
|
| 101 |
+
CVEs. English descriptions only; parent-level techniques only.
|
| 102 |
+
|
| 103 |
+
## References
|
| 104 |
+
|
| 105 |
+
- Bonhomme, C., & Dulaunoy, A. (2026). *Mapping CVEs to MITRE ATT&CK
|
| 106 |
+
Techniques: A Curated Gold-Set Classifier and the Limits of
|
| 107 |
+
LLM-Assisted Label Expansion.* [arXiv:2607.25572](https://arxiv.org/abs/2607.25572)
|
| 108 |
+
- Bonhomme, C., & Dulaunoy, A. (2026). *Beyond the Description:
|
| 109 |
+
Structured Metadata and Label Semantics for CVE-to-ATT&CK Mapping.*
|
| 110 |
+
(follow-up paper, in preparation — source of all numbers above)
|
| 111 |
+
- Trained with [VulnTrain](https://github.com/vulnerability-lookup/VulnTrain)
|
| 112 |
+
as part of the [Vulnerability-Lookup](https://vulnerability.circl.lu) project.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|