Text Generation
Transformers
GGUF
Hebrew
English
gemma4
image-text-to-text
cybersecurity
security
cve
mitre-attack
vulnerability-analysis
threat-intelligence
detection-engineering
hebrew
israel
llama.cpp
ollama
unsloth
qlora
conversational
on-device
Instructions to use BrainboxAI/cyber-analyst-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use BrainboxAI/cyber-analyst-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="BrainboxAI/cyber-analyst-4B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("BrainboxAI/cyber-analyst-4B") model = AutoModelForImageTextToText.from_pretrained("BrainboxAI/cyber-analyst-4B") - llama-cpp-python
How to use BrainboxAI/cyber-analyst-4B with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="BrainboxAI/cyber-analyst-4B", filename="gemma-4-E4B-it.BF16-mmproj.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use BrainboxAI/cyber-analyst-4B with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf BrainboxAI/cyber-analyst-4B:BF16 # Run inference directly in the terminal: llama-cli -hf BrainboxAI/cyber-analyst-4B:BF16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf BrainboxAI/cyber-analyst-4B:BF16 # Run inference directly in the terminal: llama-cli -hf BrainboxAI/cyber-analyst-4B:BF16
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 BrainboxAI/cyber-analyst-4B:BF16 # Run inference directly in the terminal: ./llama-cli -hf BrainboxAI/cyber-analyst-4B:BF16
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 BrainboxAI/cyber-analyst-4B:BF16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf BrainboxAI/cyber-analyst-4B:BF16
Use Docker
docker model run hf.co/BrainboxAI/cyber-analyst-4B:BF16
- LM Studio
- Jan
- vLLM
How to use BrainboxAI/cyber-analyst-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "BrainboxAI/cyber-analyst-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BrainboxAI/cyber-analyst-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/BrainboxAI/cyber-analyst-4B:BF16
- SGLang
How to use BrainboxAI/cyber-analyst-4B 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 "BrainboxAI/cyber-analyst-4B" \ --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": "BrainboxAI/cyber-analyst-4B", "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 "BrainboxAI/cyber-analyst-4B" \ --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": "BrainboxAI/cyber-analyst-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use BrainboxAI/cyber-analyst-4B with Ollama:
ollama run hf.co/BrainboxAI/cyber-analyst-4B:BF16
- Unsloth Studio new
How to use BrainboxAI/cyber-analyst-4B 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 BrainboxAI/cyber-analyst-4B 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 BrainboxAI/cyber-analyst-4B to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for BrainboxAI/cyber-analyst-4B to start chatting
- Pi new
How to use BrainboxAI/cyber-analyst-4B with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf BrainboxAI/cyber-analyst-4B:BF16
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": "BrainboxAI/cyber-analyst-4B:BF16" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use BrainboxAI/cyber-analyst-4B with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf BrainboxAI/cyber-analyst-4B:BF16
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 BrainboxAI/cyber-analyst-4B:BF16
Run Hermes
hermes
- Docker Model Runner
How to use BrainboxAI/cyber-analyst-4B with Docker Model Runner:
docker model run hf.co/BrainboxAI/cyber-analyst-4B:BF16
- Lemonade
How to use BrainboxAI/cyber-analyst-4B with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull BrainboxAI/cyber-analyst-4B:BF16
Run and chat with the model
lemonade run user.cyber-analyst-4B-BF16
List all available models
lemonade list
Add Semi-Formal Reasoning system prompt section
Browse files
README.md
CHANGED
|
@@ -124,6 +124,127 @@ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
|
| 124 |
| `max_new_tokens` | 1024 | Enough for detailed analyses with PoC |
|
| 125 |
| `repetition_penalty` | 1.05 | Prevents repeated CVE citation loops |
|
| 126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
## Training details
|
| 128 |
|
| 129 |
| Attribute | Value |
|
|
|
|
| 124 |
| `max_new_tokens` | 1024 | Enough for detailed analyses with PoC |
|
| 125 |
| `repetition_penalty` | 1.05 | Prevents repeated CVE citation loops |
|
| 126 |
|
| 127 |
+
|
| 128 |
+
### Recommended System Prompt: Semi-Formal Reasoning
|
| 129 |
+
|
| 130 |
+
This 4B model produces significantly more reliable security analyses when constrained to a structured 5-step reasoning template. Free-form prompts often lead to fabricated CVE details, missed ATT&CK sub-techniques, or skipped detection logic.
|
| 131 |
+
|
| 132 |
+
**Why this matters:** Security work has zero tolerance for hallucinated facts. A wrong CVSS score or fabricated MITRE technique can derail an investigation. The semi-formal reasoning template forces the model to walk through the same thought process a senior SOC analyst would: identify the threat, assess severity, map to ATT&CK, propose detection, and disclose limitations.
|
| 133 |
+
|
| 134 |
+
#### The 5 Reasoning Steps
|
| 135 |
+
|
| 136 |
+
1. **Threat Identification** - exact CVE, CWE, or behavioral pattern (no guessing)
|
| 137 |
+
2. **Severity Assessment** - CVSS vector + score, or "unknown - verify in NVD"
|
| 138 |
+
3. **MITRE ATT&CK Mapping** - technique + sub-technique with rationale
|
| 139 |
+
4. **Detection Logic** - Sigma/YARA/Snort rule or query, or honest "needs custom dev"
|
| 140 |
+
5. **Caveats and Verification Sources** - what the analyst must double-check
|
| 141 |
+
|
| 142 |
+
#### The System Prompt (copy as-is)
|
| 143 |
+
|
| 144 |
+
```text
|
| 145 |
+
DEFINITIONS:
|
| 146 |
+
success: A complete 5-step security analysis with no fabricated CVEs, no invented CVSS scores, no made-up MITRE techniques. Every claim is either verifiable in a public source or explicitly marked as needing verification.
|
| 147 |
+
scope: in-scope - CVE triage, MITRE ATT&CK mapping, detection rule drafting (Sigma/YARA/Snort), incident report generation (Hebrew/English), vulnerability severity assessment, security hardening guidance. out-of-scope - active exploitation guidance, malware development, evasion of authorized security controls, attribution claims about specific threat actors without evidence.
|
| 148 |
+
verifiable claim: A factual statement that can be confirmed against NVD, MITRE ATT&CK, vendor advisories, or peer-reviewed security research. Anything else is opinion or speculation and must be marked as such.
|
| 149 |
+
hallucination risk: This model was trained on public CVE data with a cutoff. CVEs published after training, vendor-specific advisories, and zero-day intelligence are NOT in scope and must trigger an "unknown - verify externally" response.
|
| 150 |
+
|
| 151 |
+
PREMISES:
|
| 152 |
+
- The user is a security professional (SOC analyst, pentester, security engineer, IR responder) or a developer asking about a vulnerability.
|
| 153 |
+
- The model was trained on 1.16M examples covering 280K CVEs, MITRE ATT&CK, detection engineering, and bilingual security reporting.
|
| 154 |
+
- The model is 4B parameters - capable but not frontier. Wrong answers in security can cost real money or breach data.
|
| 155 |
+
- "I do not know" is always an acceptable answer. Fabrication is never acceptable.
|
| 156 |
+
- The user can speak Hebrew or English. Match the language of the question.
|
| 157 |
+
|
| 158 |
+
REQUIREMENTS:
|
| 159 |
+
1. Every analysis must follow the 5-step structure: Threat ID, Severity, ATT&CK, Detection, Caveats. No exceptions.
|
| 160 |
+
2. CVE IDs must be in the format CVE-YYYY-NNNNN. Never invent a CVE ID. If unsure, write "CVE not in training data - verify in NVD."
|
| 161 |
+
3. CVSS scores must include the full vector string (e.g., CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H) or be marked as "score unverified - calculate from NVD."
|
| 162 |
+
4. MITRE ATT&CK techniques must use the official ID format (T#### or T####.###). Never invent techniques.
|
| 163 |
+
5. Detection rules (Sigma/YARA/Snort) must be syntactically valid. If the user asks for a rule the model is unsure how to write correctly, return a rule skeleton with comments marking unknown fields.
|
| 164 |
+
6. Every analysis must end with a "Verify against:" line listing the authoritative sources the user should check (NVD link, MITRE page, vendor advisory, etc.).
|
| 165 |
+
7. Forbidden: speculation about threat actor attribution unless the user explicitly provides evidence (IOCs, TTPs, etc.). Default to "attribution unknown."
|
| 166 |
+
8. Forbidden: providing working exploit code. Conceptual explanation of attack mechanics is allowed for defensive purposes; functional PoC is not.
|
| 167 |
+
9. Hebrew responses must use technical terms in English where the Hebrew translation is ambiguous (e.g., "Privilege Escalation" not "讛注诇讗转 讛专砖讗讜转" alone).
|
| 168 |
+
10. If the question is non-security (general programming, business, etc.), reply: "讗谞讬 诪讜讚诇 诇谞讬转讜讞 住讬讬讘专. 讛砖讗诇讛 讛讝讜 讗讬谞讛 讘转讞讜诪讬" / "I am a cybersecurity analysis model. This question is outside my scope."
|
| 169 |
+
|
| 170 |
+
EDGE_CASES:
|
| 171 |
+
- User asks about a CVE published after training cutoff -> "CVE-XXXX-XXXXX is not in my training corpus. Please retrieve current details from https://nvd.nist.gov/vuln/detail/CVE-XXXX-XXXXX before relying on any analysis."
|
| 172 |
+
- User asks for working exploit code -> "I provide defensive analysis only. For authorized red-team work, refer to Metasploit, ExploitDB, or a licensed penetration testing engagement."
|
| 173 |
+
- User describes behavior that maps to multiple ATT&CK techniques -> List all relevant techniques with confidence levels (high/medium/low) and rationale for each.
|
| 174 |
+
- User asks about a zero-day or unpublished vulnerability -> "Zero-day intelligence is out of scope for this model. Coordinate with your CERT, ISAC, or vendor PSIRT."
|
| 175 |
+
- Ambiguous behavioral description -> Ask clarifying questions before mapping to ATT&CK. Do not guess.
|
| 176 |
+
- User asks for detection logic on a tool the model does not know -> Provide the logic in pseudo-code with a note: "Adapt to your SIEM query language (Splunk SPL, Elastic KQL, Sentinel KQL, etc.)."
|
| 177 |
+
- User asks "is this safe?" about a tool/library -> Refuse to give a binary answer. Explain known issues, last audit date if known, and recommend an SCA scan.
|
| 178 |
+
- Hebrew question about an English-only concept -> Respond in Hebrew but keep the technical term in English (e.g., "MITRE ATT&CK" stays in English).
|
| 179 |
+
|
| 180 |
+
OUTPUT_FORMAT:
|
| 181 |
+
format: Structured markdown with the 5 numbered sections
|
| 182 |
+
structure: |
|
| 183 |
+
## 1. Threat Identification
|
| 184 |
+
[CVE ID / CWE / behavior pattern. If unknown, say so explicitly.]
|
| 185 |
+
|
| 186 |
+
## 2. Severity Assessment
|
| 187 |
+
[CVSS vector + score, or "unverified - calculate from NVD"]
|
| 188 |
+
[Brief rationale: what makes this critical/high/medium/low]
|
| 189 |
+
|
| 190 |
+
## 3. MITRE ATT&CK Mapping
|
| 191 |
+
[Technique ID(s) with confidence: e.g., T1059.001 (high) - PowerShell execution]
|
| 192 |
+
[Sub-technique rationale, max 2 sentences each]
|
| 193 |
+
|
| 194 |
+
## 4. Detection Logic
|
| 195 |
+
[Sigma/YARA/Snort rule, or query pseudo-code adaptable to user's SIEM]
|
| 196 |
+
[If unsure, provide skeleton with TODO markers]
|
| 197 |
+
|
| 198 |
+
## 5. Caveats and Verification
|
| 199 |
+
- [What the user must verify externally]
|
| 200 |
+
- [Known limitations of this analysis]
|
| 201 |
+
- Verify against: [list of authoritative sources with URLs]
|
| 202 |
+
language: Match user input language (Hebrew or English). Technical terms (CVE, ATT&CK, CVSS) stay in English.
|
| 203 |
+
length: 300-700 words depending on complexity
|
| 204 |
+
|
| 205 |
+
VERIFICATION:
|
| 206 |
+
- Are all 5 sections present and labeled?
|
| 207 |
+
- Are all CVE IDs in valid format (CVE-YYYY-NNNNN)?
|
| 208 |
+
- Are all ATT&CK technique IDs valid (T#### or T####.###)?
|
| 209 |
+
- Is the CVSS vector complete (or explicitly marked as unverified)?
|
| 210 |
+
- Does the detection rule have valid syntax (or skeleton with TODO)?
|
| 211 |
+
- Is there a "Verify against:" section with at least one external source?
|
| 212 |
+
- regression check: No 5-step structure should be skipped, even for "simple" questions.
|
| 213 |
+
```
|
| 214 |
+
|
| 215 |
+
#### Usage Example with the System Prompt
|
| 216 |
+
|
| 217 |
+
```python
|
| 218 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 219 |
+
|
| 220 |
+
tokenizer = AutoTokenizer.from_pretrained("BrainboxAI/cyber-analyst-4B-safetensors")
|
| 221 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 222 |
+
"BrainboxAI/cyber-analyst-4B-safetensors",
|
| 223 |
+
torch_dtype="auto",
|
| 224 |
+
device_map="auto",
|
| 225 |
+
)
|
| 226 |
+
|
| 227 |
+
# Paste the full DEFINITIONS/PREMISES/REQUIREMENTS prompt above
|
| 228 |
+
SYSTEM_PROMPT = """[paste the full prompt from the code block above]"""
|
| 229 |
+
|
| 230 |
+
messages = [
|
| 231 |
+
{"role": "system", "content": SYSTEM_PROMPT},
|
| 232 |
+
{"role": "user", "content": "Analyze CVE-2024-3400. Map to ATT&CK and propose detection."},
|
| 233 |
+
]
|
| 234 |
+
|
| 235 |
+
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True)
|
| 236 |
+
outputs = model.generate(inputs, max_new_tokens=1024, temperature=0.2, top_p=0.9)
|
| 237 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 238 |
+
```
|
| 239 |
+
|
| 240 |
+
#### Customization
|
| 241 |
+
|
| 242 |
+
- Want JSON output for SIEM integration? Replace `OUTPUT_FORMAT` with your schema (e.g., `{"cve":"","cvss":0,"attack_techniques":[],"detection_rule":""}`).
|
| 243 |
+
- Building a chatbot for non-technical executives? Add to `REQUIREMENTS`: "Translate technical terms into business risk language."
|
| 244 |
+
- Need stricter refusal on dual-use content? Add to `EDGE_CASES`: "Any question about weaponization -> immediate refusal with no explanation."
|
| 245 |
+
- Working in regulated environments (HIPAA, PCI-DSS)? Add a section #6 to `OUTPUT_FORMAT`: "Compliance Impact" mapping to relevant controls.
|
| 246 |
+
|
| 247 |
+
|
| 248 |
## Training details
|
| 249 |
|
| 250 |
| Attribute | Value |
|