Downloads · 30 days
15
20% of all-time downloads
pki/securitygpt-14b
securitygpt-14b is a text generation model from pki. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
SecurityGPT is a 14-billion parameter code generation model fine-tuned for security-focused development tasks. Built on Qwen2.5-Coder-14B-Instruct, it specializes in generating secure, production-ready code with empha…
Downloads · 30 days
15
20% of all-time downloads
All-time downloads
76
Public
Repo size
13 GB
Likes
1
Public
Click a slice to open those files.
.safetensors13 GB · 100%
From the Hugging Face model README
SecurityGPT is a 14-billion parameter code generation model fine-tuned for security-focused development tasks. Built on Qwen2.5-Coder-14B-Instruct, it specializes in generating secure, production-ready code with emphasis on best practices for web applications, API development, and cybersecurity.
Architecture: Qwen2ForCausalLM
- Hidden size: 5,120
- Num layers: 48
- Attention heads: 40
- KV heads: 8 (GQA)
- Intermediate size: 13,824
- Vocab size: 152,064
- RoPE theta: 1,000,000
- Activation: SiLU
✅ Security-First Design
✅ Best Practice Enforcement
/api/v1/ versioning)✅ Technology Stack Coverage
⚠️ This model is NOT intended for:
QLoRA (Quantized Low-Rank Adaptation) using Unsloth for optimization.
LoRA Configuration:
Rank (r): 128
Alpha: 256
Dropout: 0 (Unsloth optimized)
Target modules: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
Quantization: 4-bit (QLoRA)
Training Hyperparameters:
Batch size: 8 per device
Gradient accumulation: 4 steps (effective batch = 32)
Learning rate: 1e-4
Epochs: 5
Max sequence length: 2,048 tokens
Optimizer: AdamW 8-bit
LR scheduler: Cosine
Weight decay: 0.01
Precision: BF16
The model was fine-tuned on 16,000 instruction-output pairs focused on:
Data composition:
Final training loss: 0.026
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load model and tokenizer
model_name = "pki/securitygpt-14b"
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
# Format prompt with Qwen chat template
messages = [
{"role": "system", "content": "You are a helpful AI coding assistant specialized in secure software development."},
{"role": "user", "content": "Create a FastAPI endpoint for user signup with email and password validation."}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
# Generate
inputs = tokenizer([text], return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=1024,
temperature=0.4,
top_p=0.9,
do_sample=True
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
Step 1: Convert to GGUF (if not already converted)
# Convert merged model to GGUF
python llama.cpp/convert_hf_to_gguf.py merged_model/ \
--outfile securitygpt-14b-f16.gguf --outtype f16
# Quantize for deployment (Q8 recommended)
llama.cpp/llama-quantize \
securitygpt-14b-f16.gguf \
securitygpt-14b-q8.gguf Q8_0
Step 2: Create Modelfile
FROM ./securitygpt-14b-q8.gguf
PARAMETER temperature 0.5
PARAMETER top_p 0.9
PARAMETER num_ctx 32768
PARAMETER stop "<|im_start|>"
PARAMETER stop "<|im_end|>"
TEMPLATE """<|im_start|>system
You are a helpful AI coding assistant specialized in secure software development.<|im_end|>
<|im_start|>user
{{ .Prompt }}<|im_end|>
<|im_start|>assistant
"""
SYSTEM """You are SecurityGPT, a specialized AI assistant for secure software development. You follow security best practices including: argon2 password hashing, input validation, SQL injection prevention, XSS protection, proper authentication, and comprehensive error handling."""
Step 3: Deploy with Ollama
ollama create securitygpt:14b -f Modelfile
ollama run securitygpt:14b
1. Secure Authentication Endpoint
Create a FastAPI endpoint for user login with JWT token generation.
Use argon2 for password hashing and include proper error handling.
2. React Component with Security
Create a React login form component with email validation,
password strength checking, and CSRF protection.
3. Database Security
Write a SQLAlchemy model for user authentication with
secure password storage and audit logging.
4. API Security Review
Review this API endpoint for security vulnerabilities:
[paste code]
Domain Specificity
Training Data Constraints
Context Length
Security Limitations
✅ Always review generated code before production use ✅ Run security scanners on generated code ✅ Test thoroughly including edge cases ✅ Use alongside professional security tools ✅ Keep dependencies updated as model may reference older versions
This model should be used responsibly:
If you use SecurityGPT in your research or projects, please cite:
@misc{securitygpt2026,
title={SecurityGPT: A Security-Focused Code Generation Model},
author={[email protected]},
year={2026},
publisher={Hugging Face},
howpublished={\url{https://huggingface.co/pki/securitygpt-14b}},
note={Fine-tuned from Qwen2.5-Coder-14B-Instruct}
}
Base model citation:
@article{qwen2.5,
title={Qwen2.5-Coder Technical Report},
author={Qwen Team},
journal={arXiv preprint},
year={2024}
}
For questions, issues, or collaboration:
This model is released under the Apache 2.0 License, same as the base Qwen2.5-Coder model.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Disclaimer: This model is provided as-is for research and development purposes. Always review and test generated code before production deployment. The authors are not responsible for any damages resulting from the use of this model.