Qwen3.5-0.8B — Slips IDS Cause Analysis & Risk Assessment
Model Description
A fine-tuned version of Qwen3.5-0.8B 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.
This is the small-device version of stratosphere/qwen2.5-1.5b-slips-immune-risk: same training data, same prompts and same hyperparameters, at about half the size. Under the same LLM-as-judge evaluation it scores on par with the 1.5B model and with GPT-4o, and it runs on a Raspberry Pi 5 at about 70 seconds per incident for both analyses (see Evaluation).
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.
Files
| File | Use |
|---|---|
model.safetensors-00001-of-00001.safetensors + config/tokenizer | Full-precision (BF16) weights for Transformers |
gguf/qwen3.5-0.8b-slips-immune-risk-Q4_K_M.gguf | 529 MB — recommended for Raspberry Pi and other CPUs |
gguf/qwen3.5-0.8b-slips-immune-risk-Q5_K_M.gguf | 578 MB |
gguf/qwen3.5-0.8b-slips-immune-risk-Q8_0.gguf | 812 MB — best judge score of the three |
config.yaml | Training configuration |
The checkpoint keeps the base model's (untrained) vision encoder so it loads as a standard Qwen3.5 checkpoint; AutoModelForCausalLM loads only the 0.75B-parameter language model. The GGUF files contain the language model only.
Quick Start
llama.cpp (recommended for local and edge deployment)
hf download stratosphere/qwen3.5-0.8b-slips-immune-risk \
gguf/qwen3.5-0.8b-slips-immune-risk-Q4_K_M.gguf --local-dir .
llama-server -m gguf/qwen3.5-0.8b-slips-immune-risk-Q4_K_M.gguf \
-c 8192 -n 512 --temp 0 -fa off --port 8080
Then send each of the two prompts below as a single user message to http://localhost:8080/v1/chat/completions. The chat template embedded in the GGUF adds the default system prompt automatically.
On CPU-only devices such as the Raspberry Pi 5, keep flash attention off (-fa off): with -fa auto (the default) llama.cpp enables it, and on the Pi's CPU it slows generation on long prompts.
Python (Transformers)
Requires a recent Transformers release with Qwen3.5 support (tested with 5.17). 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/qwen3.5-0.8b-slips-immune-risk"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.bfloat16, 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")
For faster GPU inference, install the optional flash-linear-attention and causal-conv1d packages; without them Transformers uses slower reference kernels for Qwen3.5's linear-attention layers.
LoRA Adapter
The LoRA adapter itself (r=64, alpha 64, RSLoRA, ~41M parameters) is in lora_adapter/, for inspection or further fine-tuning. It was trained on unsloth/Qwen3.5-0.8B loaded in 4-bit (QLoRA). The published weights are this adapter merged into the dequantized 4-bit base; for this model, applying it to the 16-bit base gives the same judge scores within noise.
Training Details
Dataset
The training data is publicly available at stratosphere/immune-risk-sft-dataset. It is the same data used for the Qwen2.5-1.5B model.
- 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; 908 / 96 fit the 4096-token sequence length and were used)
Training Procedure
| Parameter | Value |
|---|---|
| Base model | unsloth/Qwen3.5-0.8B |
| 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, plus the linear-attention projections in_proj_qkv, in_proj_z, out_proj (18 of the 24 layers use linear attention) |
| Trainable parameters | ~41M |
| Sequence length | 4096 |
| Batch size | 1 (effective: 16 via gradient accumulation) |
| Learning rate | 2e-5, cosine, 20 warmup steps |
| Weight decay | 0.01 |
| Epochs | 3 (171 steps) |
| Optimizer | adamw_8bit |
| Precision | BF16 |
| Quantization (training) | 4-bit (QLoRA) |
| Chat format | Qwen2.5 ChatML (no thinking tags) |
| Response masking | train_on_responses_only — loss computed on assistant turns only |
| Final eval loss | 1.173 (Qwen2.5-1.5B: 1.198) |
Merge. The LoRA adapter was trained on a 4-bit quantized base. The published weights merge it into the dequantized 4-bit base, i.e. the exact weights the adapter was trained against, rather than into the original 16-bit base. For small models, merging into the original base loses part of the fine-tuning; merging into the dequantized base keeps it.
Framework Versions
- Unsloth: 2026.10.8
- TRL: 1.15.0
- Transformers: 5.17.0
- PyTorch: 2.14.1
Evaluation
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.
Overall Results
| Model | Cause (/30) | Risk (/30) | Combined (/60) |
|---|---|---|---|
| Qwen3.5-0.8B finetuned (4-bit adapter, as trained) | 16.72 | 13.07 | 29.79 |
| GPT-4o | 16.61 | 13.01 | 29.63 |
| Qwen3.5-0.8B finetuned, GGUF Q8_0 | 16.46 | 12.99 | 29.45 |
| Qwen2.5-1.5B finetuned, GGUF Q8_0 | 16.63 | 12.70 | 29.33 |
| GPT-4o-mini | 16.37 | 12.84 | 29.21 |
| Qwen3.5-0.8B finetuned, GGUF Q5_K_M | 16.36 | 12.63 | 28.99 |
| Qwen2.5-1.5B finetuned, GGUF Q5_K_M | 15.72 | 12.81 | 28.52 |
| Qwen2.5-1.5B finetuned (4-bit adapter, as trained) | 16.15 | 12.36 | 28.51 |
| Qwen2.5-1.5B finetuned, GGUF Q4_K_M | 16.19 | 12.27 | 28.46 |
| Qwen3.5-0.8B finetuned, GGUF Q4_K_M | 15.69 | 12.28 | 27.97 |
| Qwen2.5 3B (base, untuned) | 12.33 | 12.31 | 24.64 |
| Qwen2.5-1.5B (base, untuned) | 12.91 | 11.04 | 23.96 |
| Qwen3.5-0.8B (base, untuned) | 14.16 | 9.28 | 23.45 |
Fine-tuning lifts the 0.8B model from 23.5 to 28–29.8, the level of GPT-4o, GPT-4o-mini and the fine-tuned Qwen2.5-1.5B. The differences among those top models (about 1.5 points 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,840 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) |
|---|---|---|---|
| Q4_K_M | 72 s (43 + 29; prompt 100 tok/s, generation 11 tok/s) | 175 s | 2.0 GB |
| Q5_K_M | 77 s | 195 s | 2.1 GB |
| Q8_0 | 73 s (prompt 117 tok/s, generation 8.6 tok/s) | 170 s | 2.5 GB |
llama.cpp was measured with its default -fa auto. Turning flash attention off (-fa off) raises generation speed on the Pi by about 15–20% for this model (llama-bench, 2,048-token context: 13.0 vs 11.2 tok/s).
Qwen3.5-0.8B uses a hybrid architecture where only 6 of its 24 layers keep a growing KV cache, so its speed drops very little on long incidents (13.7 → 13.0 tok/s from an empty context to 2,048 tokens), unlike Qwen3-0.6B (23.6 → 13.3 tok/s).
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.
- Quantization: Q4_K_M scores about 1.5 points lower than Q8_0; use Q8_0 when memory allows (2.5 GB peak on the 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 on edge devices (Raspberry Pi, small servers)
- Input to downstream reporting or ticketing workflows
Out-of-Scope Use
- General-purpose chat or instruction following
- Image or video input (the vision encoder was not trained)
- Security domains outside network IDS (malware analysis, vulnerability scanning, etc.)
- Non-English inputs
Citation
@misc{qwen3.5-0.8b-slips-immune-risk,
title = {Qwen3.5-0.8B fine-tuned for Slips IDS cause analysis and risk assessment},
author = {Stratosphere Laboratory, CTU Prague},
year = {2026},
howpublished = {\url{https://huggingface.co/stratosphere/qwen3.5-0.8b-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: 0.8B params (0.75B language model + untrained vision encoder)
- Tensor type: BF16 (GGUF: Q4_K_M, Q5_K_M, Q8_0)
- License: Apache-2.0
- Tags: Text Generation, Transformers, Safetensors, GGUF, Network Security, IDS, SLIPS, Risk Assessment, Cause Analysis, Cybersecurity, LoRA, SFT, TRL, Unsloth