AungMoonLord_bert-log-anomaly-detection
AungMoonLord · View on Hugging Face ↗
BERT classifier that flags anomalous lines in system logs — anomaly detection for log data.
✓ verified · rehash-vs-hf-metadata at 2026-08-24T09:58:51Z
apache-2.0418.6 MB (438,909,840 bytes)transformerssafetensorsberttext-classificationtext-embeddings-inferenceendpoints_compatible
Get this model
Download AungMoonLord_bert-log-anomaly-detection.torrent
Recommended — the .torrent carries the webseed url-list, so your client can fall back to plain HTTPS if the swarm is thin. See/verify for the full download + verification walkthrough.
Model card
The complete upstream card, rendered from this payload's README.md — the same hash-verified bytes the torrent distributes. Images and off-site links are removed; the original card on Hugging Face carries them.
library_name: transformers metrics:
- accuracy
- precision
- recall
- f1 license: apache-2.0 base_model:
- google-bert/bert-base-uncased pipeline_tag: text-classification
Model Card for Model ID
Model Summary
bert-log-anomaly-detectionis a BERT-based NLP model fine-tuned for single SQL transaction log anomaly detection.The model classifies each database transaction log as either
NormalorAnomaly, with the goal of supporting AI-powered fraud detection and cybersecurity monitoring systems.This model was developed as part of the Samsung × KBTG Digital Fraud Cybersecurity Hackathon (Thailand) under the AI-Powered Fraud Detection & Prevention track.
Model Description
This model analyzes individual SQL database transaction logs and detects abnormal patterns that may indicate fraudulent, malicious, or suspicious behavior.
Demo: Hackathon prototype
- Developed by: Aungruk Vanichanai, Napat Wanitwatthakorn, Thanakrit Sriphiphattana
- Shared by: Aungruk Vanichanai
- Model type: Transformer-based binary text classifier
- Language(s) (NLP): English (SQL logs in text format)
- License: Apache 2.0
- Finetuned from model: google-bert/bert-base-uncased
Model Sources
- GitHub Repository: https://github.com/AungMoonLord/AI-Cybersecurity-Hackathon/tree/main/New%20Finetune%20Hackathon
How to Get Started with the Model
Step 1 (Setup)
import torch
from transformers import BertForSequenceClassification, BertTokenizer
MODEL_PATH = "AungMoonLord/bert-log-anomaly-detection"
model = BertForSequenceClassification.from_pretrained(MODEL_PATH)
tokenizer = BertTokenizer.from_pretrained(MODEL_PATH)
model.eval()
Step 2 (Clean and Label Logs) — Optional, but may slightly improve accuracy, recall, and F1-score
# Perfom log preprocessing
def add_prefix_token(text): # log data must pass this code before training/inferencing
# clean log
text = text.replace("\t", " ")
text = text.strip()
# add token
if text[0].isalpha() or text[3].isalpha():
return "[SQL]\n" + text
else:
return "[LOG]\n" + text
Step 3 (Create the Function for Log Classification)
def predict_log(log_text):
log_text = add_prefix_token(log_text)
inputs = tokenizer(
log_text,
return_tensors="pt",
truncation=True,
padding=True, # for cases when the inference contains more than 1 log, i.e., batch size > 1
max_length=128
)
with torch.no_grad():
logits = model(**inputs).logits
pred = torch.argmax(logits, dim=1).item()
prob = torch.softmax(logits, dim=-1).tolist()[0]
return "Normal" if pred == 1 else "Anomaly", prob
Step 4 (Samples of Inferences)
# Example 1
text1 = "SELECT * FROM users WHERE id = 1 OR 1=1"
print(predict_log(text1))
# Example 2
text2 = "2025-01-06 14:23:45 | User: anonymous | IP: 203.154.89.102 | Duration: 0.05s SELECT * FROM users WHERE username = 'admin' OR '1'='1' -- ' AND password = 'x'"
print(predict_log(text2))
# Example 3
text3 = "3051-06-22T07:20:02.296945Z 3 Query select e3mJKDCCY from 7Q8SpG8LLEWhrfpe4s5 where ph4d = 'a1S9hQa92uC1EAyJf2Y';"
print(predict_log(text3))
Application in Hackathon Project
- Developed by Waris Sripatoomrak, this model integrates with an n8n workflow to automate fraud detection within financial transaction logs.
Out-of-Scope Use
Multi-log sequence anomaly detection
Non-textual anomaly detection
Training Data
SQL database transaction logs (1,611 samples) synthetically generated by ChatGPT, Qwen, DeepSeek, Grok, Gemini, and Claude
Each log labeled as either
NormalorAnomalyData prepared for single-log classification
Evaluation
Metrics
- Training Set
| Metric | Value |
|---|---|
| Accuracy | 0.8950 |
| Precision | 0.8580 |
| Recall | 0.9026 |
| F1-score | 0.8797 |
| Validation Loss | 0.3279 |
- Test Set (Baseline — No Step 2 Preprocessing)
| Metric | Value |
|---|---|
| Accuracy | 0.6950 |
| Precision | 0.6639 |
| Recall | 0.7900 |
| F1-score | 0.7215 |
| Validation Loss | 0.6251 |
- Test Set (Full Pipeline — With Step 2 Preprocessing)
| Metric | Value |
|---|---|
| Accuracy | 0.7000 |
| Precision | 0.6613 |
| Recall | 0.8200 |
| F1-score | 0.7321 |
| Validation Loss | 0.6344 |
Summary
The model demonstrates strong anomaly detection capability with high recall, making it suitable for fraud detection and cybersecurity use cases.
Magnet link (secondary — no webseeds)
Opens the swarm directly, but carries no webseed url-list. Prefer the.torrent download above — HTTP fallback seeds ride inside it.
magnet:?xt=urn:btih:5e5898ec291bf49ef88c3798f0026e4184783f15&dn=AungMoonLord_bert-log-anomaly-detectionOpen magnet in torrent client · infohash 5e5898ec291bf49ef88c3798f0026e4184783f15
Files & hashes
| Path | Size | Method | Hash |
|---|---|---|---|
| README.md | 5.0 KB (5,109 B) | sha1-git-blob | 8d0f176bab96a803ed21e5f42f4793db1bbf0a7d |
| config.json | 707 B (707 B) | sha1-git-blob | 3c7a3dacc2d703055f052e0ab1435073e05143fc |
| model.safetensors | 417.7 MB (437,958,648 B) | sha256-lfs | 9cd32047860f126fe0e2694d188669279ababa7a60de1f25c671f6bf42d72114 |
| special_tokens_map.json | 732 B (732 B) | sha1-git-blob | ba5e3e474dd99473e6fd1bec11f3c34d406c6760 |
| tokenizer.json | 695.0 KB (711,661 B) | sha1-git-blob | 8f778e7d950e055b18b53222c75d2c54c3732df5 |
| tokenizer_config.json | 1.4 KB (1,475 B) | sha1-git-blob | 64050e8a76d5054d69beefda573049ff4fcf1a05 |
| vocab.txt | 226.1 KB (231,508 B) | sha1-git-blob | fb140275c155a9c7c5a3b3e0e77a9e839594a938 |
Provenance
| Upstream repository | AungMoonLord/bert-log-anomaly-detection |
|---|---|
| Revision (pinned) | 9ece304f330c8fa08a9ba825fd3d1adcf746aaf6 |
| Fetched at | 2026-08-24T09:58:38Z |
| License at fetch | apache-2.0 |
| Snapshot tool | huggingface · seedbank 0.1.0 |
Trackers
- udp://announce.aitorrent.org:6969/announce
- http://announce.aitorrent.org:7070/announce
- udp://announce2.aitorrent.org:6970/announce
- http://announce2.aitorrent.org:7071/announce
- udp://tracker.opentrackr.org:1337/announce
- udp://open.demonii.com:1337/announce
- udp://open.stealth.si:80/announce
- udp://exodus.desync.com:6969/announce
- udp://tracker.torrent.eu.org:451/announce