File size: 7,229 Bytes
6111c3e 40f755e 6111c3e 40f755e 6111c3e 40f755e 6111c3e 40f755e 6111c3e 40f755e 6111c3e 40f755e 6111c3e 40f755e 004deb4 40f755e 6111c3e 40f755e 6111c3e 40f755e 6111c3e 40f755e 976f1f1 c2f9da2 40f755e 6111c3e 40f755e 6111c3e 40f755e 6111c3e 40f755e 6111c3e 40f755e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
---
tags:
- autotrain
- text-generation-inference
- text-generation
- cybersécurity
- BLUE
- EDGEAI
- GRC
library_name: transformers
base_model: mistralai/Mistral-7B-Instruct-v0.3
widget:
- messages:
- role: user
content: What is your favorite condiment?
license: apache-2.0
language:
- en
- fr
---
# ELISARCyberAIEdge7B
> **Maintainer:** Dr. Sabri Sallani
> **Expertise:** AI Research & Cybersecurity
> **Adapter type:** LoRA (Low-Rank Adaptation)
> **Base model:** mistralai/Mistral-7B-v0.1 (FP16)
> **Intended use:** Offline edge deployment for CyberAI & Blue-Team scenarios
> **License:** Apache 2.0 (see LICENSE)
---
## 📖 Overview
**ELISARCyberAIEdge7B** is a LoRA adapter crafted by Dr. Sabri Sallani—AI & cybersecurity researcher—to specialize Mistral-7B for offline, on-device CyberAI and “Blue AI” (defensive) applications. Once merged with the FP16 base, you obtain a single \~5 GB GGUF that runs natively on edge hardware (e.g., Raspberry Pi 4, Jetson Nano, NVIDIA T4) without internet access.
<p align="center"> <img src="https://huggingface.co/sallani/ELISARCyberAIEdge7B/resolve/main/elisar_robot_banner.png" alt="ELISAR - AI for Cybersecurity" width="700"/> </p>
Key points:
* 🔧 **LoRA-only:** Contains low-rank delta-weights for Mistral-7B.
* 🛠️ **Edge-optimized:** Full merged GGUF runs entirely offline on typical edge GPUs/accelerators.
* 🚀 **Cybersecurity focus:** Fine-tuned on “ELISAR CyberAI Edge” corpus—vulnerability descriptions, incident reports, secure-coding examples, threat intelligence summaries.
* 👤 **Authored by Dr. Sabri Sallani:** Published under the ELISAR initiative.
---
## ⚙️ Installation
1. **Python dependencies**
```bash
pip install transformers peft accelerate sentencepiece torch
```
2. *(Optional)* **llama.cpp + GGUF tools** (to merge and run offline)
```bash
# Clone and install gguf-py
git clone --depth 1 https://github.com/ggml-org/llama.cpp.git
pip install ./llama.cpp/gguf-py
pip install llama-cpp-python
```
→ Use these tools to merge LoRA + base weights into a single GGUF.
---
## 🐍 Usage
### 1. Inference with `transformers` + `PEFT` (online GPU/CPU)
```python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
BASE_ID = "mistralai/Mistral-7B-v0.1"
ADAPTER_ID = "sallani/ELISARCyberAIEdge7B"
# 1) Load Mistral-7B base (FP16 or BF16) with automatic device placement
tokenizer = AutoTokenizer.from_pretrained(BASE_ID, use_fast=True)
base_model = AutoModelForCausalLM.from_pretrained(
BASE_ID,
torch_dtype="auto",
device_map="auto"
)
# 2) Load LoRA adapter on top
model = PeftModel.from_pretrained(
base_model,
ADAPTER_ID,
torch_dtype="auto",
device_map="auto"
)
model.eval()
# 3) Perform inference
prompt = (
"### Instruction:\n"
"Propose a set of secure-coding guidelines for Python web applications.\n"
"### Response:\n"
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
out = model.generate(
**inputs,
max_new_tokens=128,
temperature=0.8,
top_p=0.9,
repetition_penalty=1.1
)
print(tokenizer.decode(out[0], skip_special_tokens=True))
```
* **device\_map="auto"** places weights on GPU/CPU automatically (FP16 when supported).
* Adjust sampling parameters (`temperature`, `top_p`, `repetition_penalty`) for your use case.
### 2. Offline Edge Deployment via `llama.cpp` (Merged GGUF)
1. **Merge LoRA + base into a single GGUF**
```bash
python3 llama.cpp/convert_lora_to_gguf.py \
sallani/ELISARCyberAIEdge7B \ # LoRA repo or local folder
--base-model-id mistralai/Mistral-7B-v0.1 \ # HF ID of FP16 base
--outfile elisar_full_f16.gguf # Output GGUF (~5 GB)
```
* The script pulls the FP16 base automatically from HF, applies LoRA deltas, and writes a merged GGUF.
2. **Run inference on edge**
* Copy `elisar_full_f16.gguf` to your edge device (Jetson Nano, Raspberry Pi 4 + GPU, NVIDIA T4).
* Use `llama.cpp` binary to run:
```bash
./llama.cpp/main \
-m elisar_full_f16.gguf \
-p "### Instruction: Audit the following log entries for suspicious activity.\n---\n<log lines>\n---\n### Response:" \
--temp 0.7 \
--repeat_penalty 1.1 \
--n 128
```
* **No internet** is required once the GGUF is on-device.
---
## 📐 Model Details
* **Base architecture:**
Mistral-7B-v0.1 (40 transformer layers, 4096-dim embedding, 32 heads, causal LM).
* **LoRA configuration:**
* Rank = 64, α = 16
* Applied to Q/K/V and feed-forward projections
* Adapter snapshots ≈ 168 MB
* **Training corpus (ELISAR CyberAI Edge):**
* Public vulnerability databases (CVE entries, CVSS scoring).
* Real-world incident reports (MITRE ATT\&CK red vs. blue logs).
* Secure-coding patterns (OWASP Top 10, SAST examples).
* Blue-team playbooks and defensive strategies.
* **Hyperparameters:**
* Learning rate = 1e-4, batch size = 16 per GPU, 3 epochs on 8×A100 (FP16).
* Validation on unseen CVE descriptions and red-team prompts.
* **Merged GGUF (FP16):**
* \~5 GB total after merging and trimming unnecessary metadata for on-device use.
---
## 🔖 Prompt Guidelines
* **Structured prompt**
```
### Instruction:
<clear cybersecurity or defensive AI task>
### Response:
```
* **Recommended sampling**
* `temperature=0.7–0.9` for balanced creativity.
* `top_p=0.9` for nucleus sampling.
* `repetition_penalty=1.1` to reduce loops.
---
---
language: en
license: apache-2.0
tags:
- gguf
- quantized
- cybersecurity
- edge-llm
- lora
- mistral
- elisar
model_name: ELISARCyberAIEdge7B-LoRA-GGUF
pipeline_tag: text-generation
datasets:
- custom
widget:
- text: "What are the main threats targeting OT environments?"
## 📊 Stats & Adoption
* 🔄 Download tracking: [Enabled](https://huggingface.co/sallani/ELISARCyberAIEdge7B)
* 📥 Total downloads (last 30 days): _auto-updated by HF_
* 🧪 Being tested on:
- Jetson Nano (Ubuntu 20.04, CUDA 11.4)
- Raspberry Pi 4 (with Coral TPU)
- NVIDIA T4 + LLaMA.cpp
Want to share your benchmarks? Open an [Issue](https://huggingface.co/sallani/ELISARCyberAIEdge7B/issues) or pull request.
## ⚠️ License & Citation
* **License:** Apache 2.0 (see [LICENSE](LICENSE)).
* **Attribution:**
> Sallani, S. (2025). *ELISARCyberAIEdge7B: LoRA adapter for Mistral-7B specializing in offline CyberAI Edge tasks*. Hugging Face Model Hub: `sallani/ELISARCyberAIEdge7B`.
---
## 🛠️ Support & Contact
* **Report issues or feature requests:**
[https://huggingface.co/sallani/ELISARCyberAIEdge7B/issues](https://huggingface.co/sallani/ELISARCyberAIEdge7B/issues)
* **Contact the author:**
Dr. Sabri Sallani
• GitHub: [@sallani](https://github.com/sallani)
• Email: `sabri.sallani@cyberaiedge.com`
• LinkedIn: [linkedin.com/in/sabri-sallani](https://linkedin.com/in/sabri-sallani)
Thank you for using **ELISARCyberAIEdge7B**. This adapter empowers secure, offline AI at the edge for next-gen CyberAI and Blue-Team applications. |