[EN]
Gemma-2-2b for Cyber Threat Intelligence (CTI) Classification
This model is a fine-tuned version of google/gemma-2-2b-it on the mrmoor/cyber-threat-intelligence dataset. It was trained using 4-bit QLoRA to classify cybersecurity text into 17 different STIX 2.1 and NER entity categories.
This model was developed as part of the Büyük Dil Modelleri (BDM) course final project.
Model Performance
- Accuracy: 70.12% ± 0.44%
- Macro-F1: 47.98% ± 6.37%
- Zero-Shot Baseline (before fine-tuning): 35.5%
Label Classes (17 Categories)
STIX 2.1 Categories: attack-pattern, campaign, identity, location, malware, threat-actor, tools, vulnerability
NER Entities: DOMAIN, FILEPATH, IPV4, O, SHA1, SHA2, SOFTWARE, TIME, URL
How to Use
Because this is a LoRA adapter, you must load it using the PeftModel architecture:
1import torch
2from transformers import AutoTokenizer, AutoModelForSequenceClassification
3from peft import PeftModel
1. Load the base model
base_model_id = "google/gemma-2-2b-it"
base_model = AutoModelForSequenceClassification.from_pretrained(
base_model_id,
num_labels=17,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
2. Load this LoRA adapter
adapter_id = "MelihCan1115/cti-gemma-2-2b_seed123" # Kendi kullanıcı adınızı yazın
model = PeftModel.from_pretrained(base_model, adapter_id)
3. Predict
text = "A new ransomware variant encrypts victim files."
inputs = tokenizer(text, return_tensors="pt").to("cuda")
outputs = model(**inputs)
predictions = torch.argmax(outputs.logits, dim=-1)
print(predictions)
[TR]
Siber Tehdit İstihbaratı (CTI) Sınıflandırması için Gemma-2-2b
Bu model, mrmoor/cyber-threat-intelligence veri seti üzerinde google/gemma-2-2b-it modelinin ince ayarlanmış bir versiyonudur. Siber güvenlik metinlerini 17 farklı STIX 2.1 ve NER varlık kategorisine sınıflandırmak üzere 4-bit QLoRA kullanılarak eğitilmiştir.
Bu model, Büyük Dil Modelleri (LLM) dersinin final projesi kapsamında geliştirilmiştir.
Model Performansı
- Doğruluk: %70,12 ± %0,44
- Makro-F1: %47,98 ± %6,37
- Zero-Shot Referans Değeri (fine-tuning öncesi): %35,5
Etiket Sınıfları (17 Kategori)
STIX 2.1 Kategorileri: attack-pattern, campaign, identity, location, malware, threat-actor, tools, vulnerability
NER Varlıkları: DOMAIN, FILEPATH, IPV4, O, SHA1, SHA2, SOFTWARE, TIME, URL
Nasıl Kullanılır
Bu bir LoRA adaptörü olduğu için, onu PeftModel mimarisini kullanarak yüklemelisiniz:
1import torch
2from transformers import AutoTokenizer, AutoModelForSequenceClassification
3from peft import PeftModel
1. Temel modeli yükleyin
base_model_id = “google/gemma-2-2b-it”
base_model = AutoModelForSequenceClassification.from_pretrained(
base_model_id,
num_labels=17,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained (base_model_id)
2. Bu LoRA adaptörünü yükleyin
adapter_id = “MelihCan1115/cti-gemma-2-2b_seed123” # Kendi kullanıcı adınızı girin
model = PeftModel.from_pretrained(base_model, adapter_id)
3. Tahmin yapın
text = "Yeni bir fidye yazılımı türü, mağdurun dosyalarını şifreliyor