Instructions to use ProKope-AI/ProKope-SecAudit-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ProKope-AI/ProKope-SecAudit-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ProKope-AI/ProKope-SecAudit-4B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ProKope-AI/ProKope-SecAudit-4B") model = AutoModelForCausalLM.from_pretrained("ProKope-AI/ProKope-SecAudit-4B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ProKope-AI/ProKope-SecAudit-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ProKope-AI/ProKope-SecAudit-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": "ProKope-AI/ProKope-SecAudit-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ProKope-AI/ProKope-SecAudit-4B
- SGLang
How to use ProKope-AI/ProKope-SecAudit-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 "ProKope-AI/ProKope-SecAudit-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": "ProKope-AI/ProKope-SecAudit-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 "ProKope-AI/ProKope-SecAudit-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": "ProKope-AI/ProKope-SecAudit-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ProKope-AI/ProKope-SecAudit-4B with Docker Model Runner:
docker model run hf.co/ProKope-AI/ProKope-SecAudit-4B
Install from pip and serve model
# Install vLLM from pip:
pip install vllm# Start the vLLM server:
vllm serve "ProKope-AI/ProKope-SecAudit-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": "ProKope-AI/ProKope-SecAudit-4B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'Use Docker
docker model run hf.co/ProKope-AI/ProKope-SecAudit-4BRequest Access to ProKope-SecAudit-4B
Access requests are reviewed manually by ProKope AI. Weights and configurations are distributed under the Apache-2.0 license with clean-room permissive upstream provenance for self-hosted security auditing, research, and commercial integration.
By requesting access to ProKope-SecAudit-4B, you acknowledge that access requests are reviewed by ProKope AI, that use of the released model weights is governed by the Apache License 2.0 in the repository LICENSE file, and that model verdicts must be paired with static/test verification gates rather than relied upon as a standalone security boundary.
Log in or Sign Up to review the conditions and access this model content.
ProKope-SecAudit-4B™
ProKope-SecAudit-4B™ is a 4.02B-parameter (bfloat16) code security auditing and CWE remediation model built by ProKope AI™ from Qwen/Qwen3-4B-Instruct-2507 (Apache-2.0) to inspect source code snippets and pull-request diffs, emit structured vulnerability triage JSON (vulnerable, cwe_id, severity, taint_flow, root_cause), and propose minimal fixed_code patches.
Model Specifications
| Specification | Value |
|---|---|
| Architecture | Qwen3ForCausalLM (36 layers, 32 Q heads / 8 KV heads, hidden_size = 2560) |
| Parameters & Precision | 4,022,468,096 (4.02B), exported as bfloat16 (5 shards <= 1.80 GB, 8.04 GB total) |
| Context Window | 262,144 base max_position_embeddings; fine-tuned at max_len = 1,536 (0 test rows > 1,536) |
| Fine-Tuning Method | NF4 4-bit QLoRA (r = 32, lora_alpha = 64, dropout = 0.05, attention + MLP projections), assistant-only masking |
| Upstream Corpus (Clean-Room) | hitoshura25/cvefixes (Apache-2.0), ismailtasdelen/SecureCodePairs (MIT), colin/PrimeVul (MIT) |
| Class & Decontamination Controls | 50/50 vulnerable/safe pairing per source (train = 2,088, val = 404, test = 500); 0 exact duplicates & 0 8-gram/13-gram overlap |
Training Language Mix (n = 2,088) |
C (1,198 / 57.4%), C++ (190 / 9.1%), Ruby (106), PHP (106), JS (88), Go (80), Java (66), Python (64), TS (44), C# (40), other (106) |
Test Split Language Mix (n = 500) |
C (136), Go (62), Ruby (50), PHP (40), Python (40), Java (36), JS (26), C++ (26), Scala (20), TS (16), other (48) |
| Default Decoding | Greedy ("do_sample": false in generation_config.json, max_new_tokens = 768) |
| License & Gating | apache-2.0 (LICENSE), gated: manual |
Output JSON Contract & Sample Output
Every request uses a label-neutral prompt (non_unique_findings = 0) and returns structured JSON with exact keys:
| Key | Type / Values | Purpose |
|---|---|---|
vulnerable |
boolean |
true if a reachable CWE vulnerability is present; false for parameterized/allowlisted/clean code |
cwe_id |
string ("CWE-89", "NONE", ...) |
Normalized CWE identifier or "NONE" |
severity |
"NONE" | "LOW" | "MEDIUM" | "HIGH" | "CRITICAL" |
CVSS-aligned severity band ("NONE" when safe) |
title |
string |
Concise issue or verification summary |
taint_flow |
string |
Source-to-sink path or sanitization justification |
root_cause |
string |
Technical explanation of why the snippet is vulnerable or safe |
fixed_code |
string |
Minimal corrected code when vulnerable == true, else "" |
Example Input:
def get_user(conn, uid):
return conn.execute(f"SELECT * FROM users WHERE id = {uid}").fetchall()
Observed Remote Hub bfloat16 Output (excerpt):
{
"vulnerable": true,
"cwe_id": "CWE-89",
"severity": "HIGH",
"fixed_code": "def get_user(conn, uid):\n return conn.execute(\"SELECT * FROM users WHERE id = ?\", (uid,)).fetchall()"
}
Held-Out Unseen-Repo Evaluation (v2)
Measurement & Scoring Conditions:
- Full-Suite Precision Parity: The full
n = 500holdout evaluation (250vulnerable /250safe) now reports nativebfloat16(load_in_4bit=False) results directly matching the uploadedbfloat16weights (greedy,do_sample=False,max_new_tokens=768, prompttruncation=True, max_length=2048) on an RTX 5080 Laptop GPU (16 GB).- Base A/B Comparison (
n = 100): The paired baseline comparison (Qwen/Qwen3-4B-Instruct-2507vs.ProKope-SecAudit-4Bon the first100rows:45vulnerable /55safe) was measured underload_in_4bit=True(NF4 double-quant,bnb_4bit_compute_dtype=bfloat16).- Parse-Failure Accounting: In
eval_secaudit.py, any response that failsparse_model_audit_json(45/500 = 9.00%in BF16;37/500 = 7.40%in NF4) defaults tovulnerable = False— meaning parse failures on safe examples count asTNand parse failures on vulnerable examples count asFN.
1. Full Held-Out Evaluation — Native bfloat16 (n = 500: 250 Vulnerable / 250 Safe)
- Vulnerability F1:
74.29%(Accuracy = 78.40%,Precision = 91.76%,Recall = 62.40%,FPR = 5.60%) - Confusion Counts:
TP = 156,FP = 14,TN = 236,FN = 94(includes45JSON parse failures scored as predictedFalse) - JSON Valid Rate:
91.00%(45/500truncations / parse failures atmax_new_tokens = 768; mitigated in production viavLLMguided JSON decoding) - CWE Exact Match:
24.00%(60/250true vulnerable cases) - Candidate Patch Syntax Validity:
95.88%across170emitted patches (verify_patch_syntax) - Mean Per-Sample Latency (unbatched
bfloat16):9,889.8 ms
2. Per-Source Breakdown — Native bfloat16 (n = 500)
| Source Dataset | Split n (Vuln / Safe) |
Precision | Recall | Vulnerability F1 | CWE Exact | Counts (TP / FP / TN / FN) |
|---|---|---|---|---|---|---|
ismailtasdelen/SecureCodePairs |
206 (103 / 103) |
100.00% | 98.06% | 99.02% | 48 / 103 |
101 / 0 / 103 / 2 |
colin/PrimeVul |
100 (50 / 50) |
96.15% | 50.00% | 65.79% | 5 / 50 |
25 / 1 / 49 / 25 |
hitoshura25/cvefixes |
194 (97 / 97) |
69.77% | 30.93% | 42.86% | 7 / 97 |
30 / 13 / 84 / 67 |
3. Paired A/B Prefix Slice vs. Base Model (n = 100: 45 Vulnerable / 55 Safe, NF4 4-bit)
| Model | Quantization | JSON Valid | Accuracy | Precision | Recall | Vulnerability F1 | FPR | CWE Exact Match | Mean Latency |
|---|---|---|---|---|---|---|---|---|---|
Qwen/Qwen3-4B-Instruct-2507 (Base) |
NF4 4-bit | 97.00% | 63.00% | 100.00% | 17.78% | 30.19% | 0.00% (0/55) |
6.67% | 5,224.7 ms |
ProKope-SecAudit-4B (v2) |
NF4 4-bit | 92.00% | 82.00% | 93.55% | 64.44% | 76.32% | 3.64% (2/55) |
24.44% | 11,661.8 ms |
Under unbatched NF4 4-bit (n = 500 reference run), ProKope-SecAudit-4B scored 74.77% F1 (89.89% Precision, 64.00% Recall, 7.20% FPR, 92.60% JSON valid, 95.51% patch syntax valid, 11,649.1 ms mean latency). Latency vs. base reflects multi-field taint_flow, root_cause, and fixed_code synthesis.
Quickstart (transformers)
import json
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
MODEL_ID = "ProKope-AI/ProKope-SecAudit-4B"
SYSTEM_PROMPT = (
"You are ProKope-SecAudit-4B, an enterprise static and semantic security auditor. "
"Inspect the provided code snippet or diff for real, reachable CWE vulnerabilities. "
"Treat parameterized queries, safe parsers, strict allowlists, bounded copies, and "
"verified auth/path containment checks as safe (vulnerable=false) to avoid false positives. "
'Return ONLY valid JSON with exact keys: '
'"vulnerable" (bool), "cwe_id" (string like "CWE-89" or "NONE"), '
'"severity" ("NONE"|"LOW"|"MEDIUM"|"HIGH"|"CRITICAL"), '
'"title" (concise string), "taint_flow" (source -> sink or sanitization note), '
'"root_cause" (technical explanation), and "fixed_code" (minimal corrected code if vulnerable else "").'
)
def build_user_prompt(language: str, file_path: str, code_or_diff: str) -> str:
return (
f"Audit the following {language.strip()} source (`{file_path.strip()}`) "
f"for reachable security vulnerabilities.\n"
f"```{language.strip().lower()}\n{code_or_diff.strip()}\n```"
)
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
model = AutoModelForCausalLM.from_pretrained(
MODEL_ID,
dtype=torch.bfloat16,
device_map="auto",
).eval()
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{
"role": "user",
"content": build_user_prompt(
"python",
"app/db.py",
'def get_user(conn, uid):\n return conn.execute(f"SELECT * FROM users WHERE id = {uid}").fetchall()',
),
},
]
inputs = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_tensors="pt",
return_dict=True,
).to(model.device)
with torch.inference_mode():
output_ids = model.generate(**inputs, max_new_tokens=768)
raw_json = tokenizer.decode(
output_ids[0][inputs["input_ids"].shape[-1]:],
skip_special_tokens=True,
).strip()
print(json.loads(raw_json))
Training Summary
- Base Model:
Qwen/Qwen3-4B-Instruct-2507 - Dataset Splits:
2,088train (2,081kept withinmax_len = 1,536),404val (200evaluated periodically),500unseen-repo test (0rows over1,536tokens) - Optimization: Effective batch size
16(grad_accum = 16), learning rate1.5e-4,2epochs /262optimizer steps (~`71.02min, peak VRAM9.19 GB` on RTX 5080 Laptop GPU) - Validation Cross-Entropy Loss:
2.0917(step 0) →0.4565(best checkpoint)
Known Limitations, Intended Use & Out-of-Scope Use
Known Limitations
- Complex multi-file CVEs (
cvefixes): Recall drops to30.93%(42.86%F1 in BF16;41.96%in NF4) on isolatedcvefixesfunctions lacking cross-file call-graph and framework configuration context. - Language skew:
66.5%of training examples are C/C++; non-C/C++ ecosystems (especially Rust/Scala/TypeScript or framework-heavy web routes) represent smaller fractions of supervision. - Exact CWE ID granularity: Binary vulnerability triage is substantially stronger than exact
CWE-Ntaxonomy matching (24.00%exact CWE overall in BF16); inspecttaint_flowandroot_causeduring triage. - JSON truncation on verbose fixes:
9.00%(45/500in BF16;7.40%/37/500in NF4) of responses exceeded or broke strict JSON parsing undermax_new_tokens = 768. Increasemax_new_tokensor serve behindvLLMstructured JSON decoding and always parse outputs defensively.
Intended Use & Security Boundary
- Recommended Stack: Screen untrusted PR text/comments with a prompt-injection guardrail (such as ProKope-Guard-8K), scan bounded hunks/functions with
ProKope-SecAudit-4B, treat returned JSON as untrusted input, and gate every candidatefixed_codepatch through AST checks, compilation, and test execution before committing.
Out-of-Scope Use
- Autonomous merging or unverified code modification in production repositories without deterministic syntax/test gates.
- Replacement for runtime OS sandboxing, IAM/RBAC enforcement, SCA dependency scanning, or full penetration testing.
- Dual-use exploit weaponization or automated offensive target exploitation.
Contact, Gated Access, Commercial Licensing & Trademarks
- Organization: ProKope AI™
- Creator: Alan Canto
- Commercial Licensing & Enterprise Support: prokope.model@gmail.com
- Trademark Notice (NOTICE):
ProKope™,ProKope AI™,ProKope-SecAudit-4B™,ProKope-Guard-8K™, andAZAC™are common-law trademarks of Alan Canto / ProKope AI™. Pursuant to Apache License 2.0 Section 6, model weights licensing does not grant trademark rights beyond factual origin attribution.
(Clean-room Apache-2.0 / MIT upstream provenance enables unrestricted Apache-2.0 adoption and enterprise commercial support through ProKope AI™.)
@misc{canto2026prokopesecaudit4b,
author = {Alan Canto},
title = {ProKope-SecAudit-4B: Clean-Room Commercial Code Security Auditing and Remediation Model},
howpublished = {Hugging Face},
year = {2026},
url = {https://huggingface.co/ProKope-AI/ProKope-SecAudit-4B}
}
- Downloads last month
- 2
Model tree for ProKope-AI/ProKope-SecAudit-4B
Base model
Qwen/Qwen3-4B-Instruct-2507Datasets used to train ProKope-AI/ProKope-SecAudit-4B
hitoshura25/cvefixes
ismailtasdelen/SecureCodePairs
Evaluation results
- hitoshura25/cvefixes · Vulnerability Detection F1 View evaluation results 42.86 *
- colin/PrimeVul · Vulnerability Detection F1 View evaluation results 65.79 *
- ismailtasdelen/SecureCodePairs · Vulnerability Detection F1 View evaluation results 99.02 *
# Gated model: Login with a HF token with gated access permission hf auth login