DGA Multi-Family Benchmark
Collection
8 DGA detection models (CNN, BiLSTM, Bilbo, LABin, Logit, FANCI, DomURLsBERT, ModernBERT) trained on 54 malware families. • 8 items • Updated
This model is designed to classify domains as either legitimate or generated by Domain Generation Algorithms (DGA).
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("Reynier/modernbert-dga-detector")
model = AutoModelForSequenceClassification.from_pretrained("Reynier/modernbert-dga-detector")
# Example prediction
def predict_domain(domain):
inputs = tokenizer(domain, return_tensors="pt", max_length=64, truncation=True, padding=True)
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.softmax(outputs.logits, dim=-1)
legit_prob = predictions[0][0].item()
dga_prob = predictions[0][1].item()
return {"prediction": "DGA" if dga_prob > legit_prob else "LEGITIMATE",
"confidence": max(legit_prob, dga_prob)}
# Test examples
domains = ["google.com", "xkvbzpqr.net", "facebook.com", "abcdef123456.com"]
for domain in domains:
result = predict_domain(domain)
print(f"{domain} -> {result['prediction']} (confidence: {result['confidence']:.3f})")
The model is based on ModernBERT and fine-tuned for domain classification:
This model was fine-tuned on a dataset of legitimate and DGA-generated domains using:
Add your model's performance metrics here when available:
If you use this model in your research or applications, please cite it appropriately.
Check out the author's other security models:
Base model
answerdotai/ModernBERT-base