modernlog-8k
an 8k-token context system log classifier
2 min readupdated
The modernlog-8k model is designed for the automatic analysis and classification of system logs, including full stack traces and context windows. Built on top of the ModernBERT-base architecture (149M parameters) by answerdotai, it is trained to detect anomalies and severity levels (INFO, WARN, ERROR, FATAL, SECURITY_AUDIT) in distributed systems. The model processes long contexts of up to 8,192 tokens thanks to Bidirectional FlashAttention-2 support and delivers results in milliseconds. It is useful for DevOps engineers and developers to monitor infrastructure and set up automated incident response systems.
Key features
- High accuracy: Demonstrates a classification accuracy of 100.00% on a held-out test set (+87.10% absolute gain over the base model).
- Fast performance: Delivers a throughput of about 646.1 logs per second on a GPU with a latency of around 32.28 ms per log.
- Robust training: Tested on groups of unrelated unlabeled data to ensure correct operation outside the training distribution.
- Apache 2.0 license: Permits free commercial and academic use.
What you can do
- Log monitoring: Integrate the model into CI/CD pipelines or logging systems to automatically detect critical errors such as database crashes or OOM-killer events.
- Security auditing: Automatically identify SECURITY_AUDIT level events in log streams from Kubernetes, Nginx, Kafka, and Linux Syslog.
- Batch processing: Set up high-performance batch log evaluation in distributed microservices.
Example
import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer
model_id = "vennyvirtuoso/modernlog-8k"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(
model_id,
device_map="auto"
)
model.eval()
log_entry = """
[2026-11-26T04:45:12.891Z] [prod-worker-us-east-1a] [postgres-primary]
KERNEL PANIC: Out of Memory (OOM-Killer) invoked on prod-worker-us-east-1a.
"""
inputs = tokenizer(log_entry, return_tensors="pt", truncation=True, max_length=2048).to(model.device)
with torch.no_grad():
outputs = model(**inputs)
probs = torch.softmax(outputs.logits, dim=-1)[0]
pred_idx = torch.argmax(probs).item()
labels = ["INFO", "WARN", "ERROR", "FATAL", "SECURITY_AUDIT"]
print(f"Log Classification: {labels[pred_idx]} (Confidence: {probs[pred_idx]:.2%})")
Read more
DetailsBenchmarks: accuracy 100.00% (base — 12.90%), Macro-F1 1.0000 (base — 0.0515)
Architecture: ModernBERT-base (149M parameters)
Context: 8,192 tokens (Bidirectional FlashAttention-2)
Performance: 646.1 logs/sec on GPU, latency 32.28 ms/log
License: Apache 2.0










Comments