CoolFace
Modelpublic

sarahwei/MITRE-v15-tactic-bert-case-based

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
6likes16downloads
Model Card

MITRE-v15-tactic-bert-case-based

It's a fine-tuned model from mitre-bert-base-cased on the MITRE ATT&CK version 15 procedure dataset. It achieves

  • loss:0.057
  • accuracy:0.87

on evaluation dataset.

Intended uses & limitations

You can use the fine-tuned model for text classification. It aims to identify the tactic that the sentence belongs to in MITRE ATT&CK framework. A sentence or an attack may fall into several tactics.

Note that this model is primarily fine-tuned on text classification for cybersecurity. It may not perform well if the sentence is not related to attacks.

How to use

You can use the model with Tensorflow.

python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model_id = "sarahwei/MITRE-tactic-bert-case-based"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    # device_map="auto",
)
question = 'An attacker performs a SQL injection.'
input_ids = tokenizer(question,return_tensors="pt")
outputs = model(**input_ids)
logits = outputs.logits
sigmoid = torch.nn.Sigmoid()
probs = sigmoid(logits.squeeze().cpu())
predictions = np.zeros(probs.shape)
predictions[np.where(probs >= 0.5)] = 1
predicted_labels = [model.config.id2label[idx] for idx, label in enumerate(predictions) if label == 1.0]

Training procedure

Training parameter

  • learning_rate: 5e-05
  • trainbatchsize: 8
  • evalbatchsize: 8
  • seed: 0
  • optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
  • lrschedulertype: linear
  • num_epochs: 10
  • warmup_ratio: 0.01
  • weight_decay: 0.001

Training results

StepTraining LossValidation LossF1Roc AUCaccuracy
1000.4094000.1429820.7400000.8038300.610000
2000.1065000.0935030.8181820.8683820.720000
3000.0702000.0659370.8936170.9303660.810000
4000.0455000.0618650.8927040.9266250.830000
5000.0336000.0578140.9029540.9386300.860000
6000.0260000.0629820.8945150.9341070.840000
7000.0219000.0562750.9045640.9461130.870000
8000.0177000.0610580.8879670.9370670.860000
9000.0161000.0589650.8907560.9337160.870000
10000.0142000.0558850.9037660.9423720.880000
11000.0132000.0568880.8953970.9378490.880000
12000.0127000.0574840.8953970.9378490.870000