Instructions to use kholil-lil/wazuh-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kholil-lil/wazuh-model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kholil-lil/wazuh-model") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("kholil-lil/wazuh-model") model = AutoModelForCausalLM.from_pretrained("kholil-lil/wazuh-model") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - llama-cpp-python
How to use kholil-lil/wazuh-model with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="kholil-lil/wazuh-model", filename="meta-llama-3.1-8B-instruct-bnb-4bit-Q8_0.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use kholil-lil/wazuh-model with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf kholil-lil/wazuh-model:Q8_0 # Run inference directly in the terminal: llama-cli -hf kholil-lil/wazuh-model:Q8_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf kholil-lil/wazuh-model:Q8_0 # Run inference directly in the terminal: llama-cli -hf kholil-lil/wazuh-model:Q8_0
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf kholil-lil/wazuh-model:Q8_0 # Run inference directly in the terminal: ./llama-cli -hf kholil-lil/wazuh-model:Q8_0
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf kholil-lil/wazuh-model:Q8_0 # Run inference directly in the terminal: ./build/bin/llama-cli -hf kholil-lil/wazuh-model:Q8_0
Use Docker
docker model run hf.co/kholil-lil/wazuh-model:Q8_0
- LM Studio
- Jan
- vLLM
How to use kholil-lil/wazuh-model with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kholil-lil/wazuh-model" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kholil-lil/wazuh-model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/kholil-lil/wazuh-model:Q8_0
- SGLang
How to use kholil-lil/wazuh-model with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "kholil-lil/wazuh-model" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kholil-lil/wazuh-model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "kholil-lil/wazuh-model" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kholil-lil/wazuh-model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use kholil-lil/wazuh-model with Ollama:
ollama run hf.co/kholil-lil/wazuh-model:Q8_0
- Unsloth Studio new
How to use kholil-lil/wazuh-model with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for kholil-lil/wazuh-model to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for kholil-lil/wazuh-model to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for kholil-lil/wazuh-model to start chatting
- Pi new
How to use kholil-lil/wazuh-model with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf kholil-lil/wazuh-model:Q8_0
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "kholil-lil/wazuh-model:Q8_0" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use kholil-lil/wazuh-model with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf kholil-lil/wazuh-model:Q8_0
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default kholil-lil/wazuh-model:Q8_0
Run Hermes
hermes
- Docker Model Runner
How to use kholil-lil/wazuh-model with Docker Model Runner:
docker model run hf.co/kholil-lil/wazuh-model:Q8_0
- Lemonade
How to use kholil-lil/wazuh-model with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull kholil-lil/wazuh-model:Q8_0
Run and chat with the model
lemonade run user.wazuh-model-Q8_0
List all available models
lemonade list
Model Card for Wazuh Alert Classifier
Model Details
Model Description
This model is designed to classify Wazuh alerts as either true positive or false positive. It helps SOC analysts reduce false positives by filtering out non-critical alerts. The model is fine-tuned on security logs and Wazuh alerts using instruction-based learning.
- Developed by: holil
- Funded by: holil
- Shared by: holil
- Model type: Transformer-based classification model
- Language(s) (NLP): English
- License: MIT
- Finetuned from model: LLaMA 3.1 8B
Model Sources
- Repository: Wazuh Model
Uses
Direct Use
This model is intended for classifying Wazuh alerts as true positive or false positive. It assists SOC analysts in focusing on actionable alerts and reducing noise from false positives.
Downstream Use
This model can be integrated into SIEM systems, security automation platforms, and SOC dashboards to enhance alert classification.
Out-of-Scope Use
The model is not designed for general cybersecurity analysis outside of Wazuh alerts. It should not be used as a standalone security solution but as an aid for SOC analysts.
Bias, Risks, and Limitations
- False Classifications: The model may misclassify alerts, requiring human verification.
- Security Data Bias: Training data may not cover all attack patterns, leading to gaps in detection.
- Limited Scope: The model is optimized for Wazuh alerts and may not perform well on other security logs.
Recommendations
- Always validate classifications with security experts.
- Regularly update training data to adapt to evolving attack patterns.
How to Get Started with the Model
To use the model, follow these steps:
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load the model and tokenizer
model_name = "kholil-lil/wazuh-model"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
# Define the Wazuh alert input
input_text = """Classify the following Wazuh alert as a true positive or false positive. Respond only with 'True Positive' or 'False Positive'.
{
"timestamp": "2025-03-05T00:03:50.341+0000",
"rule": {
"level": 5,
"description": "Web server 400 error code.",
"id": "31101",
"firedtimes": 1,
"mail": false,
"groups": [
"web",
"accesslog",
"attack"
],
"pci_dss": [
"6.5",
"11.4"
],
"gdpr": [
"IV_35.7.d"
],
"nist_800_53": [
"SA.11",
"SI.4"
],
"tsc": [
"CC6.6",
"CC7.1",
"CC8.1",
"CC6.1",
"CC6.8",
"CC7.2",
"CC7.3"
]
},
"agent": {
"id": "xxx",
"name": "xxx-environment",
"ip": "xxx.xxx.xxx.xxx"
},
"manager": {
"name": "wazuh-server"
},
"id": "1741133030.18922",
"full_log": "8.220.202.246 - - [05/Mar/2025:00:03:49 +0000] \"GET /Kb8w HTTP/1.1\" 400 264 \"-\" \"Go-http-client/1.1\"",
"decoder": {
"name": "web-accesslog"
},
"data": {
"protocol": "GET",
"srcip": "8.220.202.246",
"id": "400",
"url": "/Kb8w"
},
"location": "/var/log/nginx/apidev-access.log"
}"""
# Tokenize the input
inputs = tokenizer(input_text, return_tensors="pt")
# Generate a response
outputs = model.generate(**inputs, max_new_tokens=5)
# Decode the output
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print("Model Response:", response)
# Example output
Model Response: True Positive
Training Details
Training Data
The model is trained on a dataset of Wazuh alerts labeled as true positive or false positive, collected from real-world SOC operations. The dataset was preprocessed and formatted using a custom Alpaca-style instruction-tuning template.
Training Procedure
- Preprocessing: Log normalization, tokenization, and label encoding.
- Training Regime: Mixed-precision FP16 training for efficiency.
- Batch Size: 2
- Gradient Accumulation Steps: 4
- Learning Rate: 2e-4
- Optimizer: AdamW 8-bit
- Epochs: 3
- Lora Config: r=16, lora_alpha=16, dropout=0
- Memory Optimization: 4-bit quantization using
unsloth
Evaluation
Testing Data, Factors & Metrics
Testing Data
A held-out set of labeled Wazuh alerts was used for evaluation.
Factors
- Alert severity levels
- Variations in log format
Metrics
- Accuracy: 92%
- Precision: 91%
- Recall: 90%
- F1 Score: 90.5%
Results
The model demonstrates high accuracy in classifying Wazuh alerts but may require periodic retraining to adapt to new threats.
Environmental Impact
- Hardware Type: T4 GPU
- Hours Used: 5
- Cloud Provider: GCP
- Carbon Emitted: Estimated using ML Impact Calculator
Technical Specifications
Model Architecture and Objective
- Transformer-based classification model fine-tuned on LLaMA 3.1 8B
- Optimized for security log classification
- LoRA-based fine-tuning with
unsloth
Compute Infrastructure
Hardware
- NVIDIA Tesla T4 GPU (15 GB RAM)
- RAM 12.7 GB
Software
- Framework: PyTorch
- Libraries: Transformers, Hugging Face Datasets, Unsloth
- Training Platform: Google Cloud Platform (Compute Engine)
🧠 FAQ
Q: Where should I extract the alerts from within Wazuh for this model?
The alerts in the example input are raw JSON data extracted from the Wazuh alert log at:
/var/ossec/logs/alerts/alerts.json
Using raw alert data is recommended because it provides the full unaltered structure of each alert. This ensures the model learns from and classifies alerts based on complete original context, which helps improve its real-world usability.
That said, you're also free to extract alerts via:
- Custom external integrations
If you're working on real-time alert processing, using Wazuh's external API integrations is ideal. You can configure your custom integration to only forward certain alert levels (e.g., level ≥ 3).
💡 For this model, alerts of level 3 and above were used during training.
If you'd like to retrain or fine-tune the model on specific alert fields only (e.g., rule.description, full_log, etc.), feel free to reach out — I can share the training script used in this project.
References:
Citation
BibTeX:
@article{kholil2025wazuh,
author = {Kholil Haq Alim Hakim},
title = {Wazuh Alert Classification using LLaMA 3.1 8B},
year = {2025},
publisher = {Hugging Face}
}
Model Card Contact
For inquiries, contact holil.
- Downloads last month
- 1,643
2-bit
8-bit
Model tree for kholil-lil/wazuh-model
Base model
meta-llama/Llama-3.1-8B