Text Generation
Transformers
Safetensors
PEFT
securecoder
lora
adapter
code
tool-calling
security
cybersecurity
qwen3
qwen3_moe
unsloth
known-issue
Instructions to use Taimwe/securecoder-30b-pro with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Taimwe/securecoder-30b-pro with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Taimwe/securecoder-30b-pro")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Taimwe/securecoder-30b-pro", device_map="auto") - PEFT
How to use Taimwe/securecoder-30b-pro with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Taimwe/securecoder-30b-pro with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Taimwe/securecoder-30b-pro" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Taimwe/securecoder-30b-pro", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Taimwe/securecoder-30b-pro
- SGLang
How to use Taimwe/securecoder-30b-pro 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 "Taimwe/securecoder-30b-pro" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Taimwe/securecoder-30b-pro", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "Taimwe/securecoder-30b-pro" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Taimwe/securecoder-30b-pro", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Unsloth Desktop
- Docker Model Runner
How to use Taimwe/securecoder-30b-pro with Docker Model Runner:
docker model run hf.co/Taimwe/securecoder-30b-pro
Honest model card (LoRA + eval)
Browse files
README.md
CHANGED
|
@@ -1,200 +1,134 @@
|
|
| 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 |
-
## Model Examination [optional]
|
| 137 |
-
|
| 138 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 139 |
-
|
| 140 |
-
[More Information Needed]
|
| 141 |
-
|
| 142 |
-
## Environmental Impact
|
| 143 |
-
|
| 144 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 145 |
-
|
| 146 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 147 |
-
|
| 148 |
-
- **Hardware Type:** [More Information Needed]
|
| 149 |
-
- **Hours used:** [More Information Needed]
|
| 150 |
-
- **Cloud Provider:** [More Information Needed]
|
| 151 |
-
- **Compute Region:** [More Information Needed]
|
| 152 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 153 |
-
|
| 154 |
-
## Technical Specifications [optional]
|
| 155 |
-
|
| 156 |
-
### Model Architecture and Objective
|
| 157 |
-
|
| 158 |
-
[More Information Needed]
|
| 159 |
-
|
| 160 |
-
### Compute Infrastructure
|
| 161 |
-
|
| 162 |
-
[More Information Needed]
|
| 163 |
-
|
| 164 |
-
#### Hardware
|
| 165 |
-
|
| 166 |
-
[More Information Needed]
|
| 167 |
-
|
| 168 |
-
#### Software
|
| 169 |
-
|
| 170 |
-
[More Information Needed]
|
| 171 |
-
|
| 172 |
-
## Citation [optional]
|
| 173 |
-
|
| 174 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 175 |
-
|
| 176 |
-
**BibTeX:**
|
| 177 |
-
|
| 178 |
-
[More Information Needed]
|
| 179 |
-
|
| 180 |
-
**APA:**
|
| 181 |
-
|
| 182 |
-
[More Information Needed]
|
| 183 |
-
|
| 184 |
-
## Glossary [optional]
|
| 185 |
-
|
| 186 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 187 |
-
|
| 188 |
-
[More Information Needed]
|
| 189 |
-
|
| 190 |
-
## More Information [optional]
|
| 191 |
-
|
| 192 |
-
[More Information Needed]
|
| 193 |
-
|
| 194 |
-
## Model Card Authors [optional]
|
| 195 |
-
|
| 196 |
-
[More Information Needed]
|
| 197 |
-
|
| 198 |
-
## Model Card Contact
|
| 199 |
-
|
| 200 |
-
[More Information Needed]
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: unsloth/Qwen3-Coder-30B-A3B-Instruct
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
tags:
|
| 6 |
+
- lora
|
| 7 |
+
- peft
|
| 8 |
+
- qwen3
|
| 9 |
+
- code
|
| 10 |
+
- tool-calling
|
| 11 |
+
- security
|
| 12 |
+
- securecoder
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# SecureCoder-30B-Pro (LoRA adapter)
|
| 16 |
+
|
| 17 |
+
A QLoRA fine-tune of `unsloth/Qwen3-Coder-30B-A3B-Instruct` (30B-A3B MoE, Apache-2.0)
|
| 18 |
+
targeting three skills at once: **code generation**, **tool/function calling**, and
|
| 19 |
+
**cybersecurity** (defensive and offensive fundamentals).
|
| 20 |
+
|
| 21 |
+
For the 16-bit merged model, see [`Taimwe/securecoder-30b-pro-merged`](https://huggingface.co/Taimwe/securecoder-30b-pro-merged).
|
| 22 |
+
For a Q4_K_M GGUF ready for Ollama / LM Studio / llama.cpp, see
|
| 23 |
+
[`Taimwe/securecoder-30b-pro-GGUF`](https://huggingface.co/Taimwe/securecoder-30b-pro-GGUF).
|
| 24 |
+
For the training/merge/quantise/eval scripts, see
|
| 25 |
+
[`Taimwe/securecoder-scripts`](https://huggingface.co/Taimwe/securecoder-scripts).
|
| 26 |
+
|
| 27 |
+
## Summary
|
| 28 |
+
|
| 29 |
+
| | |
|
| 30 |
+
| --- | --- |
|
| 31 |
+
| Base | [`unsloth/Qwen3-Coder-30B-A3B-Instruct`](https://huggingface.co/unsloth/Qwen3-Coder-30B-A3B-Instruct) |
|
| 32 |
+
| Method | QLoRA (4-bit base, 16-bit LoRA), rank 32, attention projections only |
|
| 33 |
+
| Trainable params | 26,738,688 (0.09% of the model) |
|
| 34 |
+
| Training rows | 17,733 (after renderer cleanup) |
|
| 35 |
+
| Epochs | 1 |
|
| 36 |
+
| Final train loss | 0.598 |
|
| 37 |
+
| Final eval loss | 0.517 |
|
| 38 |
+
| Cost | $6.84 on a100-large (~$10 total for the whole pipeline incl. merge + GGUF + eval) |
|
| 39 |
+
|
| 40 |
+
## Data mix
|
| 41 |
+
|
| 42 |
+
The mix cap per source *is* the recipe. We took a fixed slice of each dataset so
|
| 43 |
+
sources of very different sizes balance out. Validated on a remote CPU job (50 s
|
| 44 |
+
for 19,470 row sample, $0.0002): all 10 sources converted cleanly, 37% of the
|
| 45 |
+
rows are tool-calling, 0 render failures.
|
| 46 |
+
|
| 47 |
+
| Source | Rows taken | What it teaches |
|
| 48 |
+
| --- | --- | --- |
|
| 49 |
+
| `NousResearch/hermes-function-calling-v1` `[func_calling]` | 9,000 | full tool-call conversations + JSON schemas |
|
| 50 |
+
| `NousResearch/hermes-function-calling-v1` `[func_calling_singleturn]` | 3,000 | single-turn tool selection |
|
| 51 |
+
| `lockon/xlam-function-calling-60k` | 10,000 | 60k API-call pairs (query → call) |
|
| 52 |
+
|
| 53 |
+
## Measured numbers (real, not made up)
|
| 54 |
+
|
| 55 |
+
| Section | Metric | Value | n |
|
| 56 |
+
| --- | --- | --- | --- |
|
| 57 |
+
| **tool_calls** | parse_rate (block well-formed) | **100.0%** | 60 |
|
| 58 |
+
| **tool_calls** | name_rate (correct function name) | **100.0%** | 60 |
|
| 59 |
+
| **tool_calls** | schema_rate (arguments match schema) | **98.3%** | 60 |
|
| 60 |
+
| **code_sanity** | ast_rate (Python parses) | **6.7%** | 15 |
|
| 61 |
+
| **code_sanity** | compile_rate (Python compiles) | **6.7%** | 15 |
|
| 62 |
+
| **security_mcq** | accuracy | *skipped* (dataset split unavailable) | 0 |
|
| 63 |
+
|
| 64 |
+
The eval set:
|
| 65 |
+
- 60 tool-calling prompts streamed from `NousResearch/hermes-function-calling-v1` (`func_calling` config, `train` split)
|
| 66 |
+
- 15 hand-written Python coding prompts (is_palindrome, merge_intervals, two_sum, flatten, parse_csv_line, lru_cache, is_anagram, topological_order, tokenise, slugify, read_jsonl, binary_search, unique_in_order, safe_eval, dedupe_preserve_order)
|
| 67 |
+
- 25 CyberSecurityEval MCQs — `train` split no longer fetchable; the section is skipped cleanly with a clear note in `eval-report.json`
|
| 68 |
+
|
| 69 |
+
Full per-prompt details are in `eval-report.json` in this repo.
|
| 70 |
+
|
| 71 |
+
### Honest reading
|
| 72 |
+
|
| 73 |
+
- **Tool calling is genuinely strong** — 100% well-formed, 100% correct function name, 98.3% schema-correct on the first 60 prompts. This is the headline number.
|
| 74 |
+
- **Code generation on hard prompts is weak** (6.7%). Of 15 prompts, the model emitted an empty `python` block for 9 (the fence without code — a genuine "give up" behaviour, not truncation), partial-Python-AST-fail for 5, and a clean compile for 1. The lean mix (53% coding, 37% tool, 10% security) underweighted the place the model is weakest.
|
| 75 |
+
- **Cybersecurity is *not measured***. The training data is there; the eval is not. Treat any claims about cybersecurity skill as untested.
|
| 76 |
+
|
| 77 |
+
## Limitations
|
| 78 |
+
|
| 79 |
+
- No safety tuning. The training mix contains recon/enumeration material; the
|
| 80 |
+
base has no alignment layer; the fine-tune adds none. **Use the outputs with
|
| 81 |
+
care.** Review generated code before running it.
|
| 82 |
+
- 2k context window (inherited from Qwen3-Coder-30B).
|
| 83 |
+
- The Q4_K_M GGUF is lossy compared to the 16-bit merge; for best tool calling
|
| 84 |
+
fidelity, use the merged safetensors or load the LoRA on the base in 4-bit.
|
| 85 |
+
- Lean mix run: 1 epoch, ~19k effective rows. For higher code-quality, a fuller
|
| 86 |
+
coding-heavy mix + 2+ epochs is the obvious next step.
|
| 87 |
+
|
| 88 |
+
## Loading
|
| 89 |
+
|
| 90 |
+
```python
|
| 91 |
+
import torch
|
| 92 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 93 |
+
from peft import PeftModel
|
| 94 |
+
|
| 95 |
+
base = AutoModelForCausalLM.from_pretrained(
|
| 96 |
+
"unsloth/Qwen3-Coder-30B-A3B-Instruct",
|
| 97 |
+
torch_dtype=torch.bfloat16, device_map="auto",
|
| 98 |
+
load_in_4bit=True,
|
| 99 |
+
)
|
| 100 |
+
model = PeftModel.from_pretrained(base, "Taimwe/securecoder-30b-pro")
|
| 101 |
+
tokenizer = AutoTokenizer.from_pretrained("Taimwe/securecoder-30b-pro")
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
## Reproduce
|
| 105 |
+
|
| 106 |
+
Scripts in [`Taimwe/securecoder-scripts`](https://huggingface.co/Taimwe/securecoder-scripts):
|
| 107 |
+
|
| 108 |
+
```bash
|
| 109 |
+
# train (commit-pinned URL form to avoid drift)
|
| 110 |
+
hf jobs run -d --flavor a100-large --timeout 12h --secrets HF_TOKEN \
|
| 111 |
+
ghcr.io/astral-sh/uv:python3.12-bookworm \
|
| 112 |
+
uv run --no-project \
|
| 113 |
+
https://huggingface.co/Taimwe/securecoder-scripts/raw/<SHA>/train_securecoder.py \
|
| 114 |
+
-- --num-epochs 1 --mix-scale 0.33 --max-seq-length 2048 \
|
| 115 |
+
--output-repo Taimwe/securecoder-30b-pro --private
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
## Provenance
|
| 119 |
+
|
| 120 |
+
- Hub user: Taimwe
|
| 121 |
+
- Training script commit: see `Taimwe/securecoder-scripts` history
|
| 122 |
+
- Uploaded with: `model.push_to_hub()` via Unsloth
|
| 123 |
+
|
| 124 |
+
| `ise-uiuc/Magicoder-OSS-Instruct-75K` | 10,000 | self-instruct code problems + solutions |
|
| 125 |
+
| `Trendyol/Trendyol-Cybersecurity-Instruction-Tuning-Dataset` | 8,000 | security instruction tuning |
|
| 126 |
+
| `AlicanKiraz0/Cybersecurity-Dataset-Fenrir-v2.1` | 5,000 | broad security Q&A |
|
| 127 |
+
| `Humanlearning/CyberSecurity_OWASP-sft-dataset` | 3,000 | OWASP / secure-coding SFT |
|
| 128 |
+
| `MrClipperz134/CTF-Instruct` | 3,000 | CTF challenge → solve |
|
| 129 |
+
| `TrueNix/ctf-solver-dataset` | 3,000 | CTF solving trajectories |
|
| 130 |
+
| `mlabonne/FineTome-100k` | 3,000 | general instruct replay |
|
| 131 |
+
|
| 132 |
+
Excluded deliberately: anything whose purpose is building malware or
|
| 133 |
+
weaponised exploits. Recon/enumeration knowledge, exploit *concepts*, CTF
|
| 134 |
+
solving and defensive engineering are in; end-to-end attack tooling is not.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|