Qwen2.5-1.5B — Slips IDS Cause Analysis & Risk Assessment
Model Description
A fine-tuned version of Qwen2.5-1.5B-Instruct specialized for dual-task analysis of network security incidents from Slips IDS:
- Cause Analysis — identifying the most likely cause of the incident (malicious activity, misconfiguration, or legitimate behavior) with structured reasoning and alternative hypotheses
- Risk Assessment — producing a calibrated risk level, business impact statement, likelihood of malicious activity, and investigation priority
Slips is a network intrusion detection system that generates DAG-structured alert logs — chains of related security events per source IP per time window. This model takes those raw DAG logs and produces two complementary analyses that help analysts understand why an incident occurred and how urgently it should be investigated.
The model was fine-tuned using SFT (Supervised Fine-Tuning) on a combined cause+risk dataset with best-of-N response selection: for each training incident, the highest-scoring response among GPT-4o, GPT-4o-mini, Qwen2.5 3B, and Qwen2.5 1.5B (judged by an LLM-as-judge) was selected as ground truth. A single LoRA adapter handles both task types.
A smaller version with the same training data, stratosphere/qwen3.5-0.8b-slips-immune-risk, scores on par with this model at about half the size and runs faster on CPU-only devices such as the Raspberry Pi 5.
Quick Start
Ollama (Recommended)
Quantized GGUF models are the recommended way to run this model locally. Three quantization levels are available:
# q4_k_m — smallest, fastest (recommended for most use cases)
ollama run stratosphere/qwen2.5-1.5b-slips-immune-risk:q4_k_m
# q5_k_m — balanced quality/size
ollama run stratosphere/qwen2.5-1.5b-slips-immune-risk:q5_k_m
# q8_0 — highest quality quantized version
ollama run stratosphere/qwen2.5-1.5b-slips-immune-risk:q8_0
All three tags are available on Ollama Hub. Use the prompts in the Python section below to structure your queries. The Ollama tags set the default Qwen system prompt, an 8,192-token context (num_ctx) and an output limit of 512 tokens (num_predict), matching the evaluation setup. Tags pulled before November 2026 lack these settings; pull again to update.
On CPU-only devices, llama.cpp (llama-server -c 8192 --temp 0 -fa off) runs the same GGUF quantizations about 1.5–2.5× faster than Ollama (see Speed on a Raspberry Pi 5).
Python (Transformers)
The model uses two distinct prompt formats — one for cause analysis and one for risk assessment — applied to the same incident DAG. Each prompt is a single user message; the chat template adds the default Qwen system prompt (You are Qwen, created by Alibaba Cloud. You are a helpful assistant.), as during training and evaluation.
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "stratosphere/qwen2.5-1.5b-slips-immune-risk"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map="auto")
dag_analysis = """
... # paste your Slips DAG analysis here
"""
incident = {
"incident_id": "abc123",
"source_ip": "192.168.1.100",
"timewindow": "5",
"threat_level": 8.5,
"timeline": "2024-01-15 14:00:00 to 2024-01-15 15:00:00",
"event_count": 42,
"dag_analysis": dag_analysis,
}
# --- Task 1: Cause Analysis ---
cause_prompt = f"""You are a cybersecurity analyst. Analyze the following network security incident and provide a structured analysis of possible causes.
INCIDENT METADATA:
- Incident ID: {incident['incident_id']}
- Source IP: {incident['source_ip']}
- Timewindow: {incident['timewindow']}
- Accumulated Threat Level: {incident['threat_level']}
- Time Range: {incident['timeline']}
- Total Events: {incident['event_count']}
SECURITY EVIDENCE:
{incident['dag_analysis']}
Output Requirements:
- Respond with ONLY the analysis content
- Do NOT include any prefixes (like "AI:"), statistics, or metadata
- Do NOT include token counts, timing information, or performance stats
- Use this exact structure:
**Possible Causes:**
**1. Malicious Activity:**
• [Specific attack technique or malicious cause]
• [Additional malicious possibilities if relevant]
**2. Legitimate Activity:**
• [Benign operational cause]
• [Additional legitimate possibilities if relevant]
**3. Misconfigurations:**
• [Technical misconfigurations that could cause this behavior]
**Conclusion:** [1-2 sentence assessment of most likely cause category with recommendation for further investigation]
Guidelines:
- Be succinct (fewer words than raw evidence)
- Focus on relevant causes only (attack techniques, misconfigurations, legitimate operations)
- Use precise analyst-level language
- Maintain consistent structure and depth across all analyses
- Avoid generic definitions or unnecessary context"""
# --- Task 2: Risk Assessment ---
risk_prompt = f"""You are a cybersecurity analyst. Analyze the following network security incident and provide a structured risk assessment.
INCIDENT METADATA:
- Incident ID: {incident['incident_id']}
- Source IP: {incident['source_ip']}
- Timewindow: {incident['timewindow']}
- Accumulated Threat Level: {incident['threat_level']}
- Time Range: {incident['timeline']}
- Total Events: {incident['event_count']}
SECURITY EVIDENCE:
{incident['dag_analysis']}
Output Requirements:
- Respond with ONLY the assessment content
- Do NOT include any prefixes (like "AI:"), statistics, or metadata
- Do NOT include token counts, timing information, or performance stats
- Use this exact structure:
**Risk Level:** [Critical/High/Medium/Low]
**Justification:** [1-2 sentence technical justification for the risk level]
**Business Impact:** [Single clear sentence describing the most relevant business effect]
**Likelihood of Malicious Activity:** [High/Medium/Low] - [Brief rationale]
**Investigation Priority:** [Immediate/High/Medium/Low] - [Brief justification]
Guidelines:
- Use only the four risk levels: Critical, High, Medium, Low
- Keep justifications concise and technical
- Focus business impact on most relevant effect (data access, service disruption, etc.)
- Use consistent language for likelihood assessments
- Maintain uniform structure and depth across all assessments
- Avoid verbose or generic text"""
for prompt in [cause_prompt, risk_prompt]:
messages = [{"role": "user", "content": prompt}]
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True, return_dict=True).to(model.device)
output = model.generate(**inputs, max_new_tokens=512, do_sample=False)
print(tokenizer.decode(output[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
print("\n" + "="*60 + "\n")
LoRA Adapter
The LoRA adapter itself (r=64, alpha 64, RSLoRA) is in lora_adapter/, for inspection or further fine-tuning. It was trained on unsloth/qwen2.5-1.5b-instruct-unsloth-bnb-4bit (QLoRA). The published weights are this adapter merged into the 16-bit base; for this model, merging into the dequantized 4-bit base instead gives the same judge scores within noise.
Training Details
Dataset
The training data is publicly available at stratosphere/immune-risk-sft-dataset.
- Source: 826 incidents from real Slips IDS network captures, filtered by quality (cause score ≥ 14, risk score ≥ 10, token length checks)
- Responses: 4 model responses per incident per task (GPT-4o, GPT-4o-mini, Qwen2.5 3B, Qwen2.5 1.5B) scored by an LLM-as-judge
- Selection: Best-of-N — highest-scoring response per incident per task used as training target
- Combined dataset: cause and risk records interleaved so the model sees both task types throughout training (1328 train / 148 eval records)
- Split: 90% train / 10% eval
Training Procedure
| Parameter | Value |
|---|---|
| Base model | unsloth/Qwen2.5-1.5B-Instruct |
| Training method | SFT (Supervised Fine-Tuning) |
| Framework | Unsloth + TRL SFTTrainer |
LoRA rank (r) | 64 |
| LoRA alpha | 64 |
| LoRA dropout | 0.0 |
| RSLoRA | enabled (required at r=64) |
| LoRA targets | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Sequence length | 4096 |
| Batch size | 1 (effective: 16 via gradient accumulation) |
| Gradient accumulation steps | 16 |
| Learning rate | 2e-5 |
| LR scheduler | cosine |
| Warmup steps | 20 |
| Weight decay | 0.01 |
| Epochs | 3 |
| Optimizer | adamw_8bit |
| Precision | BF16 |
| Quantization (training) | 4bit (QLoRA) |
| Response masking | train_on_responses_only — loss computed on assistant turns only |
Framework Versions
- Unsloth: 2026.3.18
- Transformers: (auto-detected)
- PyTorch: (auto-detected)
Evaluation
Overall Results
Evaluated on 67 held-out Slips IDS incidents (62 Malware, 5 Normal) with gpt-oss-120b as an independent LLM-as-judge, temperature 0. The judge scores each answer on its own (pointwise): cause analysis on evidence grounding, cause specificity and alternative hypotheses; risk assessment on risk calibration, actionability and business impact. Each criterion is 1–10, so each task is out of 30 and the combined score out of 60. The quantized rows are GGUF builds of the published weights (the same quantization types as the Ollama tags, rebuilt with a current llama.cpp), run with the default system prompt, an 8,192-token context and a 512-token output limit, as the Ollama tags now do.
| Model | Cause (/30) | Risk (/30) | Combined (/60) |
|---|---|---|---|
| GPT-4o | 16.61 | 13.01 | 29.63 |
| Qwen3.5-0.8B finetuned, Q8_0 | 16.46 | 12.99 | 29.45 |
| GPT-4o-mini | 16.37 | 12.84 | 29.21 |
| Qwen2.5-1.5B finetuned, Q4_K_M | 16.49 | 12.64 | 29.13 |
| Qwen2.5-1.5B finetuned, Q8_0 | 16.52 | 12.55 | 29.07 |
| Qwen2.5-1.5B finetuned, Q5_K_M | 16.15 | 12.81 | 28.96 |
| Qwen2.5-1.5B finetuned (4-bit adapter, as trained) | 16.15 | 12.36 | 28.51 |
| Qwen2.5 3B (base, untuned) | 12.33 | 12.31 | 24.64 |
| Qwen2.5-1.5B (base, untuned) | 12.91 | 11.04 | 23.96 |
Fine-tuning lifts the 1.5B model from 24.0 to about 29, the level of GPT-4o and GPT-4o-mini. The differences among those top models (about 1 point out of 60) are within the spread between quantization levels.
Speed on a Raspberry Pi 5
Raspberry Pi 5 (8 GB RAM, 4 Cortex-A76 cores, no GPU), 5 median-length incidents (~1,790 input tokens per request), 8,192-token context, temperature 0. One incident = one cause request + one risk request. Same GGUF files and identical prompts in both runtimes.
| Quantization | llama.cpp (cause + risk) | Ollama 0.19 (cause + risk) | Peak RAM (llama.cpp / Ollama) |
|---|---|---|---|
| Q4_K_M | 117 s (64 + 53; prompt 50 tok/s, generation 8 tok/s) | 268 s | 2.7 / 1.3 GB |
| Q5_K_M | 137 s | 316 s | 2.9 / 1.4 GB |
| Q8_0 | 174 s (prompt 36 tok/s, generation 5 tok/s) | 274 s | 3.9 / 1.9 GB |
The Pi reached 83–84 °C and throttled during the Ollama Q4_K_M and Q5_K_M runs, so those two times are somewhat pessimistic. Most of the time goes into reading the prompt; llama.cpp does this 3× faster than Ollama on the Pi.
Known Limitations
- Long incidents: training used a 4096-token sequence length; incidents with thousands of events produce DAGs that exceed this, and quality drops on them. Inference works up to 8,192 tokens, but very long incidents take several minutes on a Raspberry Pi.
- Normal traffic: only 5 Normal incidents in the test set — results for that category are not statistically reliable.
Intended Use
- Automated cause analysis of Slips IDS alerts for security analysts
- Risk prioritization and triage of network incidents
- Input to downstream reporting or ticketing workflows
Out-of-Scope Use
- General-purpose chat or instruction following
- Security domains outside network IDS (malware analysis, vulnerability scanning, etc.)
- Non-English inputs
Citation
@misc{qwen2.5-1.5b-slips-immune-risk,
title = {Qwen2.5-1.5B fine-tuned for Slips IDS cause analysis and risk assessment},
author = {Stratosphere Laboratory, CTU Prague},
year = {2026},
howpublished = {\url{https://huggingface.co/stratosphere/qwen2.5-1.5b-slips-immune-risk}}
}
Acknowledgments
This work was supported by the NLnet Foundation as part of the IMMUNE project. NLnet Foundation promotes open internet standards and open source software.
Model Details
- Model size: 1.5B params
- Tensor type: FP16
- License: Apache-2.0
- Tags: Text Generation, Transformers, Safetensors, Network Security, IDS, SLIPS, Risk Assessment, Cause Analysis, Cybersecurity, LoRA, SFT, TRL, Unsloth