Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- Modelfile +7 -0
- README.md +116 -0
- secucoder-q4_k_m.gguf +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
secucoder-q4_k_m.gguf filter=lfs diff=lfs merge=lfs -text
|
Modelfile
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM secucoder-q4_k_m.gguf
|
| 2 |
+
|
| 3 |
+
PARAMETER temperature 0.1
|
| 4 |
+
PARAMETER top_p 0.9
|
| 5 |
+
PARAMETER num_ctx 4096
|
| 6 |
+
|
| 7 |
+
SYSTEM """You are a secure Python assistant. Help identify, explain, and fix security issues in Python code. Prefer safe, practical, and production-ready solutions."""
|
README.md
CHANGED
|
@@ -1,3 +1,119 @@
|
|
| 1 |
---
|
| 2 |
license: cc-by-nc-sa-4.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: cc-by-nc-sa-4.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
base_model: ivitopow/secucoder
|
| 6 |
+
tags:
|
| 7 |
+
- code
|
| 8 |
+
- security
|
| 9 |
+
- python
|
| 10 |
+
- gguf
|
| 11 |
+
- ollama
|
| 12 |
+
- llama-cpp
|
| 13 |
+
- cybersecurity
|
| 14 |
+
- secure-coding
|
| 15 |
+
- quantized
|
| 16 |
+
task_categories:
|
| 17 |
+
- text-generation
|
| 18 |
---
|
| 19 |
+
|
| 20 |
+
# SecuCoder — GGUF
|
| 21 |
+
|
| 22 |
+
Quantized GGUF version of [SecuCoder](https://huggingface.co/ivitopow/secucoder), a fine-tuned Llama 3.1 8B Instruct model for secure Python code generation and vulnerability remediation.
|
| 23 |
+
|
| 24 |
+
For full model details, training methodology, and evaluation results, see the [main model card](https://huggingface.co/ivitopow/secucoder).
|
| 25 |
+
|
| 26 |
+
---
|
| 27 |
+
|
| 28 |
+
## Available Files
|
| 29 |
+
|
| 30 |
+
| File | Quantization | Size | Use case |
|
| 31 |
+
|---|---|---|---|
|
| 32 |
+
| `secucoder-Q4_K_M.gguf` | Q4_K_M | ~4.6 GB | Recommended — best balance of quality and size |
|
| 33 |
+
|
| 34 |
+
---
|
| 35 |
+
|
| 36 |
+
## Usage with Ollama
|
| 37 |
+
|
| 38 |
+
**1. Download the Modelfile from this repo and create the model:**
|
| 39 |
+
|
| 40 |
+
```bash
|
| 41 |
+
ollama create secucoder -f Modelfile
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
**2. Run it:**
|
| 45 |
+
|
| 46 |
+
```bash
|
| 47 |
+
ollama run secucoder
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
**3. Or via API:**
|
| 51 |
+
|
| 52 |
+
```bash
|
| 53 |
+
curl http://localhost:11434/api/generate -d '{
|
| 54 |
+
"model": "secucoder",
|
| 55 |
+
"prompt": "Fix the security vulnerability in this Python code.\n\n```python\nname = request.args.get(\"name\")\nresp = make_response(\"Your name is \" + name)\n```\n\nCWE: CWE-079",
|
| 56 |
+
"stream": false
|
| 57 |
+
}'
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
---
|
| 61 |
+
|
| 62 |
+
## Usage with llama.cpp
|
| 63 |
+
|
| 64 |
+
```bash
|
| 65 |
+
./llama-cli \
|
| 66 |
+
-m secucoder-Q4_K_M.gguf \
|
| 67 |
+
--ctx-size 4096 \
|
| 68 |
+
--temp 0.1 \
|
| 69 |
+
--top-p 0.9 \
|
| 70 |
+
-p "You are a secure Python assistant. Fix the vulnerability in this code: ..."
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
---
|
| 74 |
+
|
| 75 |
+
## Recommended Parameters
|
| 76 |
+
|
| 77 |
+
| Parameter | Value |
|
| 78 |
+
|---|---|
|
| 79 |
+
| `temperature` | 0.1 |
|
| 80 |
+
| `top_p` | 0.9 |
|
| 81 |
+
| `num_ctx` | 4096 |
|
| 82 |
+
| `num_predict` | 3072 |
|
| 83 |
+
|
| 84 |
+
---
|
| 85 |
+
|
| 86 |
+
## System Prompt
|
| 87 |
+
|
| 88 |
+
```
|
| 89 |
+
You are a secure Python assistant. Help identify, explain, and fix security issues in Python code. Prefer safe, practical, and production-ready solutions.
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
---
|
| 93 |
+
|
| 94 |
+
## Evaluation
|
| 95 |
+
|
| 96 |
+
The full SecuCoder system (Q4 + structured prompting + RAG) achieves an overall score of **77.11** vs **60.34** for the untuned Llama 3.1 8B baseline — a **+27.8% improvement** measured by weighted static analysis findings (Bandit + Semgrep).
|
| 97 |
+
|
| 98 |
+
| Variant | Overall Score |
|
| 99 |
+
|---|---|
|
| 100 |
+
| Llama 3.1 8B Instruct (baseline) | 60.34 |
|
| 101 |
+
| SecuCoder Q4 (this model) | 61.46 |
|
| 102 |
+
| SecuCoder Q4 + structured prompt | 64.46 |
|
| 103 |
+
| SecuCoder Q4 + structured prompt + RAG | **77.11** |
|
| 104 |
+
|
| 105 |
+
---
|
| 106 |
+
|
| 107 |
+
## Related
|
| 108 |
+
|
| 109 |
+
| Resource | Link |
|
| 110 |
+
|---|---|
|
| 111 |
+
| Full model (safetensors) | [ivitopow/secucoder](https://huggingface.co/ivitopow/secucoder) |
|
| 112 |
+
| Training dataset | [ivitopow/secucoder](https://huggingface.co/datasets/ivitopow/secucoder) |
|
| 113 |
+
| Base model | [meta-llama/Llama-3.1-8B-Instruct](https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct) |
|
| 114 |
+
|
| 115 |
+
---
|
| 116 |
+
|
| 117 |
+
## License
|
| 118 |
+
|
| 119 |
+
Released under [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/). Built on Llama 3.1, subject to [Meta's Llama 3 Community License](https://llama.meta.com/llama3/license/).
|
secucoder-q4_k_m.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6762a5a2a0294e7c683dfc61119147857c37dc9777bda7d0b605b33156f6b0f1
|
| 3 |
+
size 4920738976
|