dpevzner commited on
Commit
7f65b65
·
verified ·
1 Parent(s): 11e5158

Update to latest weights (run LORA-MISTRAL_7B-20260709-232328); refresh model card with real config, dataset links, Apache-2.0

Browse files
Files changed (5) hide show
  1. MODELCARD.md +113 -80
  2. README.md +114 -80
  3. adapter_config.json +5 -5
  4. adapter_model.safetensors +1 -1
  5. training_args.bin +1 -1
MODELCARD.md CHANGED
@@ -3,6 +3,11 @@ language:
3
  - en
4
  license: apache-2.0
5
  base_model: mistralai/Mistral-7B-Instruct-v0.3
 
 
 
 
 
6
  tags:
7
  - cybersecurity
8
  - lora
@@ -12,19 +17,23 @@ tags:
12
  - threat-analysis
13
  - dual-use-detection
14
  - it-operations
15
- pipeline_tag: text-generation
16
- library_name: peft
17
  model-index:
18
- - name: CyberOps-Mistral-7B-LoRA
19
  results: []
20
  ---
21
 
22
  # CyberOps-Mistral-7B-LoRA
23
 
24
- A LoRA fine-tuned adapter for **Mistral 7B Instruct v0.3**, specialized for cybersecurity IT operations reasoning — dual-use command intent analysis, failure diagnosis, security scope assessment, and cross-shell translation.
 
 
25
 
26
  > **Adapter only** — requires `mistralai/Mistral-7B-Instruct-v0.3` as the base model.
27
 
 
 
 
 
28
  ---
29
 
30
  ## Model Details
@@ -32,71 +41,106 @@ A LoRA fine-tuned adapter for **Mistral 7B Instruct v0.3**, specialized for cybe
32
  | Field | Value |
33
  |---|---|
34
  | **Base model** | `mistralai/Mistral-7B-Instruct-v0.3` |
35
- | **Adapter type** | LoRA (PEFT) |
36
- | **Trainable parameters** | 41,943,040 (1.10% of base) |
37
- | **LoRA rank** | 16 |
38
- | **Training epochs** | 3 |
39
- | **Training records** | 3,329 |
40
- | **Precision** | fp16 (base) / fp32 (training) |
41
- | **Framework** | HuggingFace Transformers + PEFT + TRL |
42
- | **Hardware** | NVIDIA RTX 4070 Laptop GPU (8GB VRAM) |
43
- | **Training time** | ~8.5 hours per run |
44
- | **Training dataset** | [dpevzner/Cybersecurity_Reasoning_Dataset](https://huggingface.co/datasets/dpevzner/Cybersecurity_Reasoning_Dataset) |
 
 
 
 
 
 
45
 
46
  ---
47
 
48
- ## Intended Use
49
 
50
- This model is designed for **offline, air-gapped cybersecurity operations environments**. It is a domain-specific reasoning assistant for IT security testing.
 
51
 
52
- ### Primary capabilities
 
 
 
 
 
 
53
 
54
- - **Dual-use command intent analysis** — Given an ambiguous security command (e.g., `Get-Process lsass`, `net user /domain`, `Get-ADUser`), the model produces structured benign and malicious interpretations with specific contextual reasoning.
55
- - **Failure diagnosis** — Classifies shell and tool failures by type: `privilege_failure`, `syntax_failure`, `environment_mismatch`, `dependency_absence`, `stale_documentation`.
56
- - **Security scope violation identification** — Flags commands that exceed authorized scope and recommends compliant alternatives.
57
- - **Tool correctness** — Recommends correct PowerShell, CMD, and bash commands for security-relevant tasks including registry queries, event log analysis, firewall management, and process memory analysis.
58
- - **Cross-shell translation** — Converts security commands between PowerShell, bash, and CMD with behavioral parity notes.
59
 
60
- ### Out of scope
 
 
 
 
61
 
62
- - General threat intelligence, malware analysis, CVE assessment, and network forensics are not covered in the current training corpus (planned for Phase 3 expansion).
63
- - Not suitable for use as a general-purpose assistant.
64
- - Not designed for or tested on offensive security automation.
 
65
 
66
  ---
67
 
68
- ## Training Data
69
 
70
- The training corpus contains **3,329 synthetic records** across three curriculum epochs:
 
 
 
 
 
 
71
 
72
- | Epoch | Folders | Records | Content |
73
- |---|---|---|---|
74
- | 1 | `03_toolknowledge`, `05_detection_rules` | 1,070 | Tool syntax, SIGMA rules, network knowledge |
75
- | 2 | `04_goldens`, `05_seedcases` | 1,331 | Golden responses, execution traces, seedcases |
76
- | 3 | `06_contrast_pairs` | 928 | Contrast pairs, terminology, format-repair, gap-fill records |
77
 
78
- No real incident data, PII, or proprietary content is included.
 
 
 
 
79
 
80
- The training corpus is derived from and continues to be updated alongside the **[dpevzner/Cybersecurity_Reasoning_Dataset](https://huggingface.co/datasets/dpevzner/Cybersecurity_Reasoning_Dataset)** on HuggingFace, which is maintained as an active part of this project.
 
 
81
 
82
  ---
83
 
84
- ## Benchmark Performance
 
 
 
85
 
86
- Evaluated on a 50-item rubric-scored benchmark across 5 families:
 
 
 
 
87
 
88
- | Family | Items | Baseline (Run 6) | Run 13 | Delta |
89
- |---|---|---|---|---|
90
- | tool_correctness | 10 | ~73 avg | ~81 avg | +8 |
91
- | cross_shell_translation | 10 | ~71 avg | ~72 avg | +1 |
92
- | failure_diagnosis | 10 | ~30 avg | ~70 avg | +40 |
93
- | ambiguity_reasoning | 10 | ~93 avg | ~84 avg | -9 |
94
- | safety_scope | 10 | ~10 avg | ~30 avg | +20 |
95
- | **Overall** | **50** | **56.28** | **69.43** | **+13.15** |
96
 
97
- Baseline (untuned Mistral 7B Instruct v0.3): **27.43 avg**
 
 
 
 
 
 
 
98
 
99
- > Trained on 3,329 records across a structured three-epoch curriculum. Run 13 represents the best-performing checkpoint, trained from a clean base adapter to prevent format interference from prior synthesis batches.
 
100
 
101
  ---
102
 
@@ -108,15 +152,12 @@ from peft import PeftModel
108
  import torch
109
 
110
  BASE_MODEL = "mistralai/Mistral-7B-Instruct-v0.3"
111
- ADAPTER = "your-username/CyberOps-Mistral-7B-LoRA"
112
 
113
  tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL)
114
  model = AutoModelForCausalLM.from_pretrained(
115
- BASE_MODEL,
116
- dtype=torch.float16,
117
- device_map="auto",
118
- max_memory={0: "5GiB", "cpu": "20GiB"}
119
- )
120
  model = PeftModel.from_pretrained(model, ADAPTER)
121
  model.eval()
122
 
@@ -131,51 +172,43 @@ with torch.no_grad():
131
  print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
132
  ```
133
 
134
- ---
135
-
136
- ## Training Curriculum Design
137
-
138
- The three-epoch curriculum is carefully ordered to prevent interference between learning phases:
139
-
140
- 1. **Epoch 1** teaches foundational tool knowledge and detection rules — syntax, correct commands, platform-specific behavior
141
- 2. **Epoch 2** teaches execution context — golden responses, ambiguity reasoning, security scope awareness
142
- 3. **Epoch 3** teaches contrast and refinement — dual-use contrast pairs, terminology precision, gap repair
143
-
144
- > **Critical:** New synthesis batches must always be placed in Epoch 3 (`06_contrast_pairs`). Placing new records in Epoch 2 caused catastrophic regression in ambiguity reasoning (Run 7: 8/10 PASS → 0/10 PASS). The curriculum order is a hard constraint, not a preference.
145
 
146
  ---
147
 
148
  ## Limitations
149
 
150
- - Ambiguity reasoning scores vary across items — ar_009 and ar_010 consistently score below baseline, indicating the model produces the correct structure but misses specific required keyword anchors for those scenarios.
151
- - Safety scope detection is improving but inconsistent — ss_001, ss_004, ss_006, ss_007, ss_010 remain at zero across runs.
152
- - GPU telemetry (util%, temp, power) reads zero due to an NVML polling bug in the training environment — training functioned correctly despite this.
153
- - Evaluated only on synthetic benchmarks. Real-world performance on live security operations tasks has not been measured.
 
 
154
 
155
  ---
156
 
157
  ## Ethical Considerations
158
 
159
- This model is trained to analyze dual-use commands — commands that have both legitimate administrative uses and potential malicious applications. It is designed for **defensive security operations** — helping analysts understand whether observed commands are likely benign or malicious in context.
160
-
161
- The model should not be used to generate offensive security tooling, attack automation, or to assist in unauthorized access to systems. All training data was synthesized under operator oversight with explicit content governance controls.
162
 
163
  ---
164
 
165
  ## Citation
166
 
167
- ```
168
- @misc{cyberops-mistral-7b-lora-2026,
169
- title = {CyberOps-Mistral-7B-LoRA: A LoRA Fine-Tuned Adapter for Cybersecurity IT Operations Reasoning},
 
170
  year = {2026},
171
- note = {LoRA adapter for Mistral 7B Instruct v0.3, trained on 3329 synthetic cybersecurity records
172
- across a three-epoch curriculum covering tool correctness, ambiguity reasoning,
173
- failure diagnosis, security scope analysis, and cross-shell translation.}
174
  }
175
  ```
176
 
177
  ---
178
 
179
- ## Model Card Contact
180
-
181
- Training environment: Alienware M16R2 / RTX 4070 Laptop GPU / Windows 11.
 
3
  - en
4
  license: apache-2.0
5
  base_model: mistralai/Mistral-7B-Instruct-v0.3
6
+ library_name: peft
7
+ pipeline_tag: text-generation
8
+ datasets:
9
+ - dpevzner/Cybersecurity_Reasoning_Dataset_MistralFamily_7b
10
+ - dpevzner/Cybersecurity_Reasoning_Dataset
11
  tags:
12
  - cybersecurity
13
  - lora
 
17
  - threat-analysis
18
  - dual-use-detection
19
  - it-operations
 
 
20
  model-index:
21
+ - name: CyberOps_Mistral_7B_LoRA
22
  results: []
23
  ---
24
 
25
  # CyberOps-Mistral-7B-LoRA
26
 
27
+ A LoRA fine-tuned adapter for **Mistral 7B Instruct v0.3**, specialized for cybersecurity
28
+ IT-operations reasoning — dual-use command intent analysis, failure diagnosis, security
29
+ scope assessment, tool correctness, and cross-shell translation.
30
 
31
  > **Adapter only** — requires `mistralai/Mistral-7B-Instruct-v0.3` as the base model.
32
 
33
+ **Weights provenance:** `final_adapter` from training run
34
+ `LORA-MISTRAL_7B-20260709-232328` (latest). Best confirmed benchmark across the iterative
35
+ training loop: **88.1** (50-item rubric).
36
+
37
  ---
38
 
39
  ## Model Details
 
41
  | Field | Value |
42
  |---|---|
43
  | **Base model** | `mistralai/Mistral-7B-Instruct-v0.3` |
44
+ | **Adapter type** | LoRA (PEFT 0.19.1) |
45
+ | **LoRA rank `r`** | 16 |
46
+ | **`lora_alpha`** | 32 |
47
+ | **`lora_dropout`** | 0.05 |
48
+ | **`bias`** | none |
49
+ | **Target modules** | `q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj` (all linear) |
50
+ | **Trainable parameters** | ~41,943,040 (~1.10% of base); 448 LoRA tensors |
51
+ | **Task type** | `CAUSAL_LM` |
52
+ | **Training method** | Supervised fine-tuning (SFT) via TRL; iterative single-epoch repair on prior best |
53
+ | **Effective batch** | 8 (per-device 1 × grad-accum 8) |
54
+ | **Learning rate** | 2e-4 |
55
+ | **Max sequence length** | 1024 |
56
+ | **Training records** | ~4,615 (123 curriculum files) |
57
+ | **Frameworks** | TRL 1.2.0 · Transformers 5.6.2 · PEFT 0.19.1 · PyTorch 2.5.1+cu121 |
58
+ | **Hardware** | NVIDIA RTX 4070 Laptop GPU (8 GB) · 64 GB RAM · ~5.56 GB peak VRAM |
59
+ | **Best benchmark** | **88.1** avg (50-item rubric) |
60
 
61
  ---
62
 
63
+ ## Model-Family Compatibility
64
 
65
+ Optimized for the **Mistral / Llama instruction-tuned family**. The training data uses the
66
+ Alpaca-style instruct format:
67
 
68
+ ```
69
+ ### Instruction:
70
+ [prompt]
71
+
72
+ ### Response:
73
+ [answer]
74
+ ```
75
 
76
+ **The binding is to this prompt *format*, not the architecture.** The same dataset trained
77
+ on three bases shows the format mismatch — not capability — drives the gap:
 
 
 
78
 
79
+ | Base model | Prompt format | Best benchmark |
80
+ |---|---|---|
81
+ | `mistralai/Mistral-7B-Instruct-v0.3` | native (Alpaca) | **88.1** |
82
+ | `deepseek-ai/deepseek-llm-7b-chat` | mismatched | **47.38** |
83
+ | `microsoft/Phi-3.5-mini-instruct` | mismatched | early experiments |
84
 
85
+ Recommended base models for **this** adapter: `mistralai/Mistral-7B-Instruct-v0.3`
86
+ (primary), other Mistral 7B Instruct point releases, or Llama-3/3.1 8B Instruct (compatible
87
+ format; requires retraining on that base). **For DeepSeek/Gemma/ChatML/Qwen, use the
88
+ model-agnostic dataset** (below) rendered in each family's native format.
89
 
90
  ---
91
 
92
+ ## Datasets
93
 
94
+ - **Training data (format-specific):**
95
+ [`dpevzner/Cybersecurity_Reasoning_Dataset_MistralFamily_7b`](https://huggingface.co/datasets/dpevzner/Cybersecurity_Reasoning_Dataset_MistralFamily_7b)
96
+ — ~4,615 records in the Mistral/Llama `### Instruction:`/`### Response:` format.
97
+ - **Model-agnostic variant:**
98
+ [`dpevzner/Cybersecurity_Reasoning_Dataset`](https://huggingface.co/datasets/dpevzner/Cybersecurity_Reasoning_Dataset)
99
+ — neutral canonical corpus + Mistral/DeepSeek/ChatML/Gemma rendered variants (to train
100
+ other families without the format-mismatch penalty).
101
 
102
+ ### Curriculum (hard-ordered, 3-epoch)
 
 
 
 
103
 
104
+ | Epoch | Folders | Records |
105
+ |---|---|---|
106
+ | 1 | `03_toolknowledge`, `05_detection_rules` | ~1,077 |
107
+ | 2 | `04_goldens`, `05_seedcases` | ~1,508 |
108
+ | 3 | `06_contrast_pairs` | ~2,030 |
109
 
110
+ New synthesis/repair records go in Epoch 3; placing them in Epoch 2 previously caused sharp
111
+ regression in ambiguity reasoning (hard constraint). The benchmark is held out with zero
112
+ overlap with training data.
113
 
114
  ---
115
 
116
+ ## Intended Use
117
+
118
+ For **offline / air-gapped cybersecurity operations** — a domain-specific reasoning
119
+ assistant for authorized security testing and SOC support.
120
 
121
+ **Capabilities:** dual-use command intent analysis; failure diagnosis (`privilege_failure`,
122
+ `syntax_failure`, `environment_mismatch`, `dependency_absence`, `stale_documentation`);
123
+ security scope assessment; tool correctness (PowerShell/CMD/bash); cross-shell translation.
124
+ **Out of scope:** general threat intel, malware RE, CVE assessment, offensive automation,
125
+ general-purpose assistant use.
126
 
127
+ ---
128
+
129
+ ## Benchmark
130
+
131
+ 50-item rubric across five families. Best **88.1**; stable **88.0** most recent.
 
 
 
132
 
133
+ | Family | Items | Baseline | Best |
134
+ |---|---|---|---|
135
+ | tool_correctness | 10 | ~73 | ~91.7 |
136
+ | cross_shell_translation | 10 | ~71 | ~97 |
137
+ | failure_diagnosis | 10 | ~30 | ~85 |
138
+ | ambiguity_reasoning | 10 | ~100 | ~95.8 |
139
+ | safety_scope | 10 | ~10 | ~70 |
140
+ | **Overall** | **50** | **56.28** | **88.1** |
141
 
142
+ Reached a **capacity ceiling at ~88 (rank 16)**: further repairs fix targeted items but
143
+ displace others ~1:1. Progressing requires higher LoRA rank, not more data.
144
 
145
  ---
146
 
 
152
  import torch
153
 
154
  BASE_MODEL = "mistralai/Mistral-7B-Instruct-v0.3"
155
+ ADAPTER = "dpevzner/CyberOps_Mistral_7B_LoRA"
156
 
157
  tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL)
158
  model = AutoModelForCausalLM.from_pretrained(
159
+ BASE_MODEL, dtype=torch.float16, device_map="auto",
160
+ max_memory={0: "5GiB", "cpu": "20GiB"})
 
 
 
161
  model = PeftModel.from_pretrained(model, ADAPTER)
162
  model.eval()
163
 
 
172
  print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
173
  ```
174
 
175
+ This adapter expects the `### Instruction:` / `### Response:` format; other formats degrade
176
+ output quality due to the format binding described above.
 
 
 
 
 
 
 
 
 
177
 
178
  ---
179
 
180
  ## Limitations
181
 
182
+ - **Adapter-capacity ceiling at ~88 (rank 16)** — repairs fix items but regress others ~1:1.
183
+ - **Safety scope is the weakest family (~70)** — items ss_001/002/006/007/010 inconsistent.
184
+ - **Ambiguity reasoning oscillates** (ar_008/009/010) under heavy contrast-pair synthesis.
185
+ - **Substring-based scoring** — a correctly paraphrased answer can be scored a miss.
186
+ - **GPU telemetry reads zero** (NVML polling gap) — cosmetic; training is correct.
187
+ - **Synthetic evaluation only** — live-operations performance not measured.
188
 
189
  ---
190
 
191
  ## Ethical Considerations
192
 
193
+ Trained to analyze **dual-use** commands for **defensive** security operations. Not for
194
+ generating offensive tooling, attack automation, or unauthorized access. All training data
195
+ was synthesized under operator oversight with explicit content-governance controls.
196
 
197
  ---
198
 
199
  ## Citation
200
 
201
+ ```bibtex
202
+ @misc{cyberops_mistral_7b_lora_2026,
203
+ title = {CyberOps-Mistral-7B-LoRA: A LoRA Adapter for Cybersecurity IT-Operations Reasoning},
204
+ author = {Pevzner, D.},
205
  year = {2026},
206
+ note = {LoRA (r=16, alpha=32) adapter for Mistral 7B Instruct v0.3, trained on ~4,615
207
+ synthetic cybersecurity reasoning records; best benchmark 88.1 on a 50-item rubric.}
 
208
  }
209
  ```
210
 
211
  ---
212
 
213
+ *Training environment: Alienware M16R2 / RTX 4070 Laptop GPU / Windows 11. Weights from run
214
+ `LORA-MISTRAL_7B-20260709-232328` (script v4.7).*
 
README.md CHANGED
@@ -3,6 +3,11 @@ language:
3
  - en
4
  license: apache-2.0
5
  base_model: mistralai/Mistral-7B-Instruct-v0.3
 
 
 
 
 
6
  tags:
7
  - cybersecurity
8
  - lora
@@ -12,19 +17,23 @@ tags:
12
  - threat-analysis
13
  - dual-use-detection
14
  - it-operations
15
- pipeline_tag: text-generation
16
- library_name: peft
17
  model-index:
18
- - name: CyberOps-Mistral-7B-LoRA
19
  results: []
20
  ---
21
 
22
  # CyberOps-Mistral-7B-LoRA
23
 
24
- A LoRA fine-tuned adapter for **Mistral 7B Instruct v0.3**, specialized for cybersecurity IT operations reasoning — dual-use command intent analysis, failure diagnosis, security scope assessment, and cross-shell translation.
 
 
25
 
26
  > **Adapter only** — requires `mistralai/Mistral-7B-Instruct-v0.3` as the base model.
27
 
 
 
 
 
28
  ---
29
 
30
  ## Model Details
@@ -32,71 +41,106 @@ A LoRA fine-tuned adapter for **Mistral 7B Instruct v0.3**, specialized for cybe
32
  | Field | Value |
33
  |---|---|
34
  | **Base model** | `mistralai/Mistral-7B-Instruct-v0.3` |
35
- | **Adapter type** | LoRA (PEFT) |
36
- | **Trainable parameters** | 41,943,040 (1.10% of base) |
37
- | **LoRA rank** | 16 |
38
- | **Training epochs** | 3 |
39
- | **Training records** | 3,329 |
40
- | **Precision** | fp16 (base) / fp32 (training) |
41
- | **Framework** | HuggingFace Transformers + PEFT + TRL |
42
- | **Hardware** | NVIDIA RTX 4070 Laptop GPU (8GB VRAM) |
43
- | **Training time** | ~8.5 hours per run |
44
- | **Training dataset** | [dpevzner/Cybersecurity_Reasoning_Dataset](https://huggingface.co/datasets/dpevzner/Cybersecurity_Reasoning_Dataset) |
 
 
 
 
 
 
45
 
46
  ---
47
 
48
- ## Intended Use
49
 
50
- This model is designed for **offline, air-gapped cybersecurity operations environments**. It is a domain-specific reasoning assistant for IT security testing.
 
51
 
52
- ### Primary capabilities
 
 
53
 
54
- - **Dual-use command intent analysis** — Given an ambiguous security command (e.g., `Get-Process lsass`, `net user /domain`, `Get-ADUser`), the model produces structured benign and malicious interpretations with specific contextual reasoning.
55
- - **Failure diagnosis** — Classifies shell and tool failures by type: `privilege_failure`, `syntax_failure`, `environment_mismatch`, `dependency_absence`, `stale_documentation`.
56
- - **Security scope violation identification** — Flags commands that exceed authorized scope and recommends compliant alternatives.
57
- - **Tool correctness** — Recommends correct PowerShell, CMD, and bash commands for security-relevant tasks including registry queries, event log analysis, firewall management, and process memory analysis.
58
- - **Cross-shell translation** — Converts security commands between PowerShell, bash, and CMD with behavioral parity notes.
 
59
 
60
- ### Out of scope
 
 
 
 
61
 
62
- - General threat intelligence, malware analysis, CVE assessment, and network forensics are not covered in the current training corpus (planned for Phase 3 expansion).
63
- - Not suitable for use as a general-purpose assistant.
64
- - Not designed for or tested on offensive security automation.
 
65
 
66
  ---
67
 
68
- ## Training Data
69
 
70
- The training corpus contains **3,329 synthetic records** across three curriculum epochs:
 
 
 
 
 
 
71
 
72
- | Epoch | Folders | Records | Content |
73
- |---|---|---|---|
74
- | 1 | `03_toolknowledge`, `05_detection_rules` | 1,070 | Tool syntax, SIGMA rules, network knowledge |
75
- | 2 | `04_goldens`, `05_seedcases` | 1,331 | Golden responses, execution traces, seedcases |
76
- | 3 | `06_contrast_pairs` | 928 | Contrast pairs, terminology, format-repair, gap-fill records |
77
 
78
- No real incident data, PII, or proprietary content is included.
 
 
 
 
79
 
80
- The training corpus is derived from and continues to be updated alongside the **[dpevzner/Cybersecurity_Reasoning_Dataset](https://huggingface.co/datasets/dpevzner/Cybersecurity_Reasoning_Dataset)** on HuggingFace, which is maintained as an active part of this project.
 
 
81
 
82
  ---
83
 
84
- ## Benchmark Performance
 
 
 
85
 
86
- Evaluated on a 50-item rubric-scored benchmark across 5 families:
 
 
 
 
87
 
88
- | Family | Items | Baseline (Run 6) | Run 13 | Delta |
89
- |---|---|---|---|---|
90
- | tool_correctness | 10 | ~73 avg | ~81 avg | +8 |
91
- | cross_shell_translation | 10 | ~71 avg | ~72 avg | +1 |
92
- | failure_diagnosis | 10 | ~30 avg | ~70 avg | +40 |
93
- | ambiguity_reasoning | 10 | ~93 avg | ~84 avg | -9 |
94
- | safety_scope | 10 | ~10 avg | ~30 avg | +20 |
95
- | **Overall** | **50** | **56.28** | **69.43** | **+13.15** |
96
 
97
- Baseline (untuned Mistral 7B Instruct v0.3): **27.43 avg**
98
 
99
- > Trained on 3,329 records across a structured three-epoch curriculum. Run 13 represents the best-performing checkpoint, trained from a clean base adapter to prevent format interference from prior synthesis batches.
 
 
 
 
 
 
 
 
 
 
 
 
100
 
101
  ---
102
 
@@ -108,15 +152,12 @@ from peft import PeftModel
108
  import torch
109
 
110
  BASE_MODEL = "mistralai/Mistral-7B-Instruct-v0.3"
111
- ADAPTER = "your-username/CyberOps-Mistral-7B-LoRA"
112
 
113
  tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL)
114
  model = AutoModelForCausalLM.from_pretrained(
115
- BASE_MODEL,
116
- dtype=torch.float16,
117
- device_map="auto",
118
- max_memory={0: "5GiB", "cpu": "20GiB"}
119
- )
120
  model = PeftModel.from_pretrained(model, ADAPTER)
121
  model.eval()
122
 
@@ -131,50 +172,43 @@ with torch.no_grad():
131
  print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
132
  ```
133
 
134
- ---
135
-
136
- ## Training Curriculum Design
137
-
138
- The three-epoch curriculum is carefully ordered to prevent interference between learning phases:
139
-
140
- 1. **Epoch 1** teaches foundational tool knowledge and detection rules — syntax, correct commands, platform-specific behavior
141
- 2. **Epoch 2** teaches execution context — golden responses, ambiguity reasoning, security scope awareness
142
- 3. **Epoch 3** teaches contrast and refinement — dual-use contrast pairs, terminology precision, gap repair
143
-
144
- > **Critical:** New synthesis batches must always be placed in Epoch 3 (`06_contrast_pairs`). Placing new records in Epoch 2 caused catastrophic regression in ambiguity reasoning (Run 7: 8/10 PASS → 0/10 PASS). The curriculum order is a hard constraint, not a preference.
145
 
146
  ---
147
 
148
  ## Limitations
149
 
150
- - Ambiguity reasoning scores vary across items — ar_009 and ar_010 consistently score below baseline, indicating the model produces the correct structure but misses specific required keyword anchors for those scenarios.
151
- - Safety scope detection is improving but inconsistent — ss_001, ss_004, ss_006, ss_007, ss_010 remain at zero across runs.
152
- - GPU telemetry (util%, temp, power) reads zero due to an NVML polling bug in the training environment — training functioned correctly despite this.
153
- - Evaluated only on synthetic benchmarks. Real-world performance on live security operations tasks has not been measured.
 
 
154
 
155
  ---
156
 
157
  ## Ethical Considerations
158
 
159
- This model is trained to analyze dual-use commands — commands that have both legitimate administrative uses and potential malicious applications. It is designed for **defensive security operations** — helping analysts understand whether observed commands are likely benign or malicious in context.
160
-
161
- The model should not be used to generate offensive security tooling, attack automation, or to assist in unauthorized access to systems. All training data was synthesized under operator oversight with explicit content governance controls.
162
 
163
  ---
164
 
165
  ## Citation
166
 
167
- ```
168
- @misc{cyberops-mistral-7b-lora-2026,
169
- title = {CyberOps-Mistral-7B-LoRA: A LoRA Fine-Tuned Adapter for Cybersecurity IT Operations Reasoning},
 
170
  year = {2026},
171
- note = {LoRA adapter for Mistral 7B Instruct v0.3, trained on 3329 synthetic cybersecurity records
172
- across a three-epoch curriculum covering tool correctness, ambiguity reasoning,
173
- failure diagnosis, security scope analysis, and cross-shell translation.}
174
  }
175
  ```
176
 
 
177
 
178
- ## Model Card Contact
179
-
180
- Training environment: Alienware M16R2 / RTX 4070 Laptop GPU / Windows 11.
 
3
  - en
4
  license: apache-2.0
5
  base_model: mistralai/Mistral-7B-Instruct-v0.3
6
+ library_name: peft
7
+ pipeline_tag: text-generation
8
+ datasets:
9
+ - dpevzner/Cybersecurity_Reasoning_Dataset_MistralFamily_7b
10
+ - dpevzner/Cybersecurity_Reasoning_Dataset
11
  tags:
12
  - cybersecurity
13
  - lora
 
17
  - threat-analysis
18
  - dual-use-detection
19
  - it-operations
 
 
20
  model-index:
21
+ - name: CyberOps_Mistral_7B_LoRA
22
  results: []
23
  ---
24
 
25
  # CyberOps-Mistral-7B-LoRA
26
 
27
+ A LoRA fine-tuned adapter for **Mistral 7B Instruct v0.3**, specialized for cybersecurity
28
+ IT-operations reasoning — dual-use command intent analysis, failure diagnosis, security
29
+ scope assessment, tool correctness, and cross-shell translation.
30
 
31
  > **Adapter only** — requires `mistralai/Mistral-7B-Instruct-v0.3` as the base model.
32
 
33
+ **Weights provenance:** `final_adapter` from training run
34
+ `LORA-MISTRAL_7B-20260709-232328` (latest). Best confirmed benchmark across the iterative
35
+ training loop: **88.1** (50-item rubric).
36
+
37
  ---
38
 
39
  ## Model Details
 
41
  | Field | Value |
42
  |---|---|
43
  | **Base model** | `mistralai/Mistral-7B-Instruct-v0.3` |
44
+ | **Adapter type** | LoRA (PEFT 0.19.1) |
45
+ | **LoRA rank `r`** | 16 |
46
+ | **`lora_alpha`** | 32 |
47
+ | **`lora_dropout`** | 0.05 |
48
+ | **`bias`** | none |
49
+ | **Target modules** | `q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj` (all linear) |
50
+ | **Trainable parameters** | ~41,943,040 (~1.10% of base); 448 LoRA tensors |
51
+ | **Task type** | `CAUSAL_LM` |
52
+ | **Training method** | Supervised fine-tuning (SFT) via TRL; iterative single-epoch repair on prior best |
53
+ | **Effective batch** | 8 (per-device 1 × grad-accum 8) |
54
+ | **Learning rate** | 2e-4 |
55
+ | **Max sequence length** | 1024 |
56
+ | **Training records** | ~4,615 (123 curriculum files) |
57
+ | **Frameworks** | TRL 1.2.0 · Transformers 5.6.2 · PEFT 0.19.1 · PyTorch 2.5.1+cu121 |
58
+ | **Hardware** | NVIDIA RTX 4070 Laptop GPU (8 GB) · 64 GB RAM · ~5.56 GB peak VRAM |
59
+ | **Best benchmark** | **88.1** avg (50-item rubric) |
60
 
61
  ---
62
 
63
+ ## Model-Family Compatibility
64
 
65
+ Optimized for the **Mistral / Llama instruction-tuned family**. The training data uses the
66
+ Alpaca-style instruct format:
67
 
68
+ ```
69
+ ### Instruction:
70
+ [prompt]
71
 
72
+ ### Response:
73
+ [answer]
74
+ ```
75
+
76
+ **The binding is to this prompt *format*, not the architecture.** The same dataset trained
77
+ on three bases shows the format mismatch — not capability — drives the gap:
78
 
79
+ | Base model | Prompt format | Best benchmark |
80
+ |---|---|---|
81
+ | `mistralai/Mistral-7B-Instruct-v0.3` | native (Alpaca) | **88.1** |
82
+ | `deepseek-ai/deepseek-llm-7b-chat` | mismatched | **47.38** |
83
+ | `microsoft/Phi-3.5-mini-instruct` | mismatched | early experiments |
84
 
85
+ Recommended base models for **this** adapter: `mistralai/Mistral-7B-Instruct-v0.3`
86
+ (primary), other Mistral 7B Instruct point releases, or Llama-3/3.1 8B Instruct (compatible
87
+ format; requires retraining on that base). **For DeepSeek/Gemma/ChatML/Qwen, use the
88
+ model-agnostic dataset** (below) rendered in each family's native format.
89
 
90
  ---
91
 
92
+ ## Datasets
93
 
94
+ - **Training data (format-specific):**
95
+ [`dpevzner/Cybersecurity_Reasoning_Dataset_MistralFamily_7b`](https://huggingface.co/datasets/dpevzner/Cybersecurity_Reasoning_Dataset_MistralFamily_7b)
96
+ — ~4,615 records in the Mistral/Llama `### Instruction:`/`### Response:` format.
97
+ - **Model-agnostic variant:**
98
+ [`dpevzner/Cybersecurity_Reasoning_Dataset`](https://huggingface.co/datasets/dpevzner/Cybersecurity_Reasoning_Dataset)
99
+ — neutral canonical corpus + Mistral/DeepSeek/ChatML/Gemma rendered variants (to train
100
+ other families without the format-mismatch penalty).
101
 
102
+ ### Curriculum (hard-ordered, 3-epoch)
 
 
 
 
103
 
104
+ | Epoch | Folders | Records |
105
+ |---|---|---|
106
+ | 1 | `03_toolknowledge`, `05_detection_rules` | ~1,077 |
107
+ | 2 | `04_goldens`, `05_seedcases` | ~1,508 |
108
+ | 3 | `06_contrast_pairs` | ~2,030 |
109
 
110
+ New synthesis/repair records go in Epoch 3; placing them in Epoch 2 previously caused sharp
111
+ regression in ambiguity reasoning (hard constraint). The benchmark is held out with zero
112
+ overlap with training data.
113
 
114
  ---
115
 
116
+ ## Intended Use
117
+
118
+ For **offline / air-gapped cybersecurity operations** — a domain-specific reasoning
119
+ assistant for authorized security testing and SOC support.
120
 
121
+ **Capabilities:** dual-use command intent analysis; failure diagnosis (`privilege_failure`,
122
+ `syntax_failure`, `environment_mismatch`, `dependency_absence`, `stale_documentation`);
123
+ security scope assessment; tool correctness (PowerShell/CMD/bash); cross-shell translation.
124
+ **Out of scope:** general threat intel, malware RE, CVE assessment, offensive automation,
125
+ general-purpose assistant use.
126
 
127
+ ---
 
 
 
 
 
 
 
128
 
129
+ ## Benchmark
130
 
131
+ 50-item rubric across five families. Best **88.1**; stable **88.0** most recent.
132
+
133
+ | Family | Items | Baseline | Best |
134
+ |---|---|---|---|
135
+ | tool_correctness | 10 | ~73 | ~91.7 |
136
+ | cross_shell_translation | 10 | ~71 | ~97 |
137
+ | failure_diagnosis | 10 | ~30 | ~85 |
138
+ | ambiguity_reasoning | 10 | ~100 | ~95.8 |
139
+ | safety_scope | 10 | ~10 | ~70 |
140
+ | **Overall** | **50** | **56.28** | **88.1** |
141
+
142
+ Reached a **capacity ceiling at ~88 (rank 16)**: further repairs fix targeted items but
143
+ displace others ~1:1. Progressing requires higher LoRA rank, not more data.
144
 
145
  ---
146
 
 
152
  import torch
153
 
154
  BASE_MODEL = "mistralai/Mistral-7B-Instruct-v0.3"
155
+ ADAPTER = "dpevzner/CyberOps_Mistral_7B_LoRA"
156
 
157
  tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL)
158
  model = AutoModelForCausalLM.from_pretrained(
159
+ BASE_MODEL, dtype=torch.float16, device_map="auto",
160
+ max_memory={0: "5GiB", "cpu": "20GiB"})
 
 
 
161
  model = PeftModel.from_pretrained(model, ADAPTER)
162
  model.eval()
163
 
 
172
  print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
173
  ```
174
 
175
+ This adapter expects the `### Instruction:` / `### Response:` format; other formats degrade
176
+ output quality due to the format binding described above.
 
 
 
 
 
 
 
 
 
177
 
178
  ---
179
 
180
  ## Limitations
181
 
182
+ - **Adapter-capacity ceiling at ~88 (rank 16)** — repairs fix items but regress others ~1:1.
183
+ - **Safety scope is the weakest family (~70)** — items ss_001/002/006/007/010 inconsistent.
184
+ - **Ambiguity reasoning oscillates** (ar_008/009/010) under heavy contrast-pair synthesis.
185
+ - **Substring-based scoring** — a correctly paraphrased answer can be scored a miss.
186
+ - **GPU telemetry reads zero** (NVML polling gap) — cosmetic; training is correct.
187
+ - **Synthetic evaluation only** — live-operations performance not measured.
188
 
189
  ---
190
 
191
  ## Ethical Considerations
192
 
193
+ Trained to analyze **dual-use** commands for **defensive** security operations. Not for
194
+ generating offensive tooling, attack automation, or unauthorized access. All training data
195
+ was synthesized under operator oversight with explicit content-governance controls.
196
 
197
  ---
198
 
199
  ## Citation
200
 
201
+ ```bibtex
202
+ @misc{cyberops_mistral_7b_lora_2026,
203
+ title = {CyberOps-Mistral-7B-LoRA: A LoRA Adapter for Cybersecurity IT-Operations Reasoning},
204
+ author = {Pevzner, D.},
205
  year = {2026},
206
+ note = {LoRA (r=16, alpha=32) adapter for Mistral 7B Instruct v0.3, trained on ~4,615
207
+ synthetic cybersecurity reasoning records; best benchmark 88.1 on a 50-item rubric.}
 
208
  }
209
  ```
210
 
211
+ ---
212
 
213
+ *Training environment: Alienware M16R2 / RTX 4070 Laptop GPU / Windows 11. Weights from run
214
+ `LORA-MISTRAL_7B-20260709-232328` (script v4.7).*
 
adapter_config.json CHANGED
@@ -30,13 +30,13 @@
30
  "rank_pattern": {},
31
  "revision": null,
32
  "target_modules": [
33
- "k_proj",
34
- "down_proj",
35
- "v_proj",
36
  "up_proj",
 
37
  "gate_proj",
38
- "o_proj",
39
- "q_proj"
40
  ],
41
  "target_parameters": null,
42
  "task_type": "CAUSAL_LM",
 
30
  "rank_pattern": {},
31
  "revision": null,
32
  "target_modules": [
33
+ "o_proj",
34
+ "q_proj",
 
35
  "up_proj",
36
+ "v_proj",
37
  "gate_proj",
38
+ "k_proj",
39
+ "down_proj"
40
  ],
41
  "target_parameters": null,
42
  "task_type": "CAUSAL_LM",
adapter_model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:3634aff20134bb16c29a0cb2d2e82cf81727d968b66ffe27424472b6a0c1679f
3
  size 83946192
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:061bc08f9913730b2c60a761df90fcd98fa58d314832e0b37780a7d42f288766
3
  size 83946192
training_args.bin CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:183da78f2b91f0f88eb543a917e7707ca1073512f1b342aaba09d130f8af0486
3
  size 5496
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1f45c274daf6e462bc3cf83e22652a45487780ef4e7bd4d16243b7566b8f855c
3
  size 5496