random1st commited on
Commit
ed3894d
·
verified ·
1 Parent(s): 9253262

Update model card for v4 (Qwen3.5-0.8B, ~800MB Q8)

Browse files
Files changed (1) hide show
  1. README.md +29 -14
README.md CHANGED
@@ -13,7 +13,7 @@ datasets:
13
  pipeline_tag: text-classification
14
  ---
15
 
16
- # secguard-guard -- Shell Command Safety Classifier
17
 
18
  Binary classifier for shell commands: **safe** vs **destructive**.
19
 
@@ -21,21 +21,34 @@ Binary classifier for shell commands: **safe** vs **destructive**.
21
 
22
  | Property | Value |
23
  |----------|-------|
24
- | Base model | [Qwen/Qwen3.5-2B](https://huggingface.co/Qwen/Qwen3.5-2B) |
25
- | Fine-tuning | LoRA (rank 8, 2.8M trainable params / 1.88B total) |
26
  | Quantization | Q8_0 (GGUF) |
27
- | Size | 1.9 GB |
28
  | Context | 512 tokens |
29
  | Inference | llama.cpp / llama-cpp-rs |
30
 
31
  ## Training
32
 
33
- - **Dataset**: 21,430 labeled examples (balanced 50/50)
34
  - **Destructive** (10,715): SSH-Shell-Attacks honeypot commands (ML4Net, 408K sessions) + synthetic SaaS CLI patterns
35
  - **Safe** (10,715): NL2Bash corpus (12.6K real admin commands) + synthetic dev/ops commands
36
- - **Method**: MLX LoRA, 8 layers, batch 4, lr 5e-5, 400 iterations
37
- - **Loss**: Train 0.388, Val 0.394
38
- - **Hardware**: Apple Silicon (M-series), ~12 minutes training
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
  ## What it detects
41
 
@@ -51,19 +64,21 @@ Commands the model learns to classify as **destructive**:
51
  ## Usage with secguard
52
 
53
  This model is Phase 3 (ML brain) in secguard's three-phase guard:
54
- 1. **Policy allowlist** -- known-safe commands (zero latency)
55
- 2. **Heuristic rules** -- 40+ regex patterns (zero latency)
56
- 3. **ML brain** -- this model (catches what rules miss)
57
 
58
  ```bash
59
- secguard model
 
60
  ```
61
 
62
  ## Limitations
63
 
64
  - Trained on English commands only
65
- - SSH honeypot data may not represent all attack vectors
66
- - Confidence threshold: 85% (tunable in secguard config)
 
67
 
68
  ## License
69
 
 
13
  pipeline_tag: text-classification
14
  ---
15
 
16
+ # secguard-guard Shell Command Safety Classifier
17
 
18
  Binary classifier for shell commands: **safe** vs **destructive**.
19
 
 
21
 
22
  | Property | Value |
23
  |----------|-------|
24
+ | Base model | [Qwen/Qwen3.5-0.8B](https://huggingface.co/Qwen/Qwen3.5-0.8B) |
25
+ | Fine-tuning | LoRA (rank 16, α=32, 4.26M trainable / 752M total) |
26
  | Quantization | Q8_0 (GGUF) |
27
+ | Size | ~800 MB |
28
  | Context | 512 tokens |
29
  | Inference | llama.cpp / llama-cpp-rs |
30
 
31
  ## Training
32
 
33
+ - **Dataset**: 21,430 labeled examples (balanced 50/50, ChatML format)
34
  - **Destructive** (10,715): SSH-Shell-Attacks honeypot commands (ML4Net, 408K sessions) + synthetic SaaS CLI patterns
35
  - **Safe** (10,715): NL2Bash corpus (12.6K real admin commands) + synthetic dev/ops commands
36
+ - **Method**: MLX LoRA, 16 layers, batch 4, lr 1e-5, 1000 iterations
37
+ - **Loss**: Train 0.393, Val Val
38
+ - **Test accuracy**: 98.8% (500 held-out examples)
39
+ - **Hardware**: Apple Silicon M3 Max, ~0 minutes training
40
+
41
+ ## Notes on inference
42
+
43
+ Qwen3.5 reasoning models emit `<think>…</think>` blocks before the final answer.
44
+ The runtime (`secguard-brain`) strips the thinking block via `rfind("</think>")`
45
+ before matching the label, so the model is used as a classifier without
46
+ retraining to suppress reasoning.
47
+
48
+ The MLX → GGUF pipeline requires three post-processing fixes for Qwen3.5
49
+ (tensor name rename, conv1d transpose, norm −1). Without them, the model
50
+ produces multilingual token salad. This GGUF was produced through the fixed
51
+ pipeline.
52
 
53
  ## What it detects
54
 
 
64
  ## Usage with secguard
65
 
66
  This model is Phase 3 (ML brain) in secguard's three-phase guard:
67
+ 1. **Policy allowlist** known-safe commands (zero latency)
68
+ 2. **Heuristic rules** 40+ regex patterns (zero latency)
69
+ 3. **ML brain** this model (catches what rules miss)
70
 
71
  ```bash
72
+ secguard model # downloads this GGUF to ~/.secguard/models/
73
+ secguard init --global # installs Claude Code / Gemini / Codex hooks
74
  ```
75
 
76
  ## Limitations
77
 
78
  - Trained on English commands only
79
+ - SSH honeypot data doesn't represent all attack vectors
80
+ - Confidence threshold: 0.85 (tunable in secguard config)
81
+ - Below threshold → verdict falls through to safe (heuristic stays as backstop)
82
 
83
  ## License
84