Downloads · 30 days
13
2% of all-time downloads
mhndayesh/gemma-4-12B-security-expert-GGUF
gemma-4-12B-security-expert-GGUF is a text generation model from mhndayesh. Use it when you need the model to write or continue text. It is set up for llama.cpp. The card lists the license as gemma.
A 12B model that writes secure code by default — an application-security FactBank is baked into its chat-template and fires inside the inference engine to steer the model off insecure-by-default patterns. Weights unto…
Downloads · 30 days
13
2% of all-time downloads
All-time downloads
861
Public
Repo size
14 GB
Likes
0
Public
Click a slice to open those files.
.gguf14 GB · 100%
From the Hugging Face model README
A 12B model that writes secure code by default — an application-security FactBank is baked into its chat-template and fires inside the inference engine to steer the model off insecure-by-default patterns. Weights untouched; no external RAG. This repo ships two editions (see below).
🔗 Full project: github.com/mhndayesh/experts-models
| edition | file | when to use | notes |
|---|---|---|---|
| thinking-OFF (default) | gemma-4-12B-security-expert-Q4_0.gguf | production, speed, reliability | 0 empty answers, fast, secure. No reasoning trace. The safe default. |
| thinking-ON | gemma-4-12B-security-expert-thinking-Q4_0.gguf | you want a visible reasoning trace | Shows its work and is strong on most tasks, but ~10% of the hardest-reasoning prompts can run long and return a blank answer (fails safe — it does not emit insecure code; just retry). Needs a large context + generous output budget. |
Both editions carry the same bank. They differ only in whether chain-of-thought is on. We ship both so you know exactly what you're getting — a landmine fact reverses a trained habit, and with thinking on the model sometimes over-reasons back toward its prior, so the thinking edition trades some reliability for a reasoning trace. Thinking-ON has a known llama.cpp Gemma-4 fix applied (the generation prompt opens the thought channel) + strong authority framing so facts hold; the residual ~10% is inherent to reasoning-on.
temperature 1.0, top_k 64, top_p 0.95, min_p 0.01. The min_p 0.01 floor
is important — it stops the low-temperature repetition loop that otherwise yields empty answers.contextLength 32768 is baked). The bank injects ~3,400
tokens per query, so a small context truncates the answer — especially with thinking on.max_tokens (reasoning traces run ~2–3k tokens); too
small a cap truncates before the answer.Given a normal coding request it silently corrects insecure defaults, e.g. torch.load(weights_only=True)
(post-cutoff), XXE resolve_entities=False, yaml.safe_load, secrets over random, os.environ creds,
parameterized SQL, ast.literal_eval over eval, constant-time HMAC compare. You don't name the
vulnerability — the bank is indexed by the coding task, so it fires on benign prompts.
External SecurityEval (s2e-lab, MSR 2022, 121 Python CWE tasks). Every arm below is the shipped baked
GGUF, thinking-OFF, served on my own llama-server with identical scoring; DeepSeek-V4
(deepseek-v4-flash) run on the same prompts in no-thinking mode (thinking disabled) — to match the
thinking-off editions here (its reasoning mode could score higher; this is an apples-to-apples, thinking-off
comparison). Table is the common pattern-checkable subset (21 tasks) where every arm is machine-judgeable.
| model (baked, thinking-off) | secure / 21 |
|---|---|
| e2b base | 11 |
| e2b + bank | 13 |
| 12b base | 17 |
| 12b + bank | 17 |
| 26b base | 17 |
| 26b + bank | 19 — best |
| DeepSeek-V4 (cloud) | 14 |
Reading it: bigger model → more secure. The bank lifts each model and helps most where the base is weak
Honest note: these are the in-template (prompt-only) baked editions. The FactBank retrieval method reaches higher when run as a served loop with a HyDE draft-key + authority framing (e2b 14→25 on the 28-task subset) — that draft-key is the big lever for benign security prompts and is not in the baked template. The numbers above are what the shipped GGUFs actually do.
The bank template is 4.2 MB — over LM Studio's ~980 KB raw-GGUF cap, so for LM Studio use the Hub virtual models (they hand the full template to the engine, no cap), which also carry the settings above:
# thinking-OFF (recommended)
llama-server -m gemma-4-12B-security-expert-Q4_0.gguf --jinja --ctx-size 32768 --port 8080
# thinking-ON
llama-server -m gemma-4-12B-security-expert-thinking-Q4_0.gguf --jinja --ctx-size 32768 --port 8080
Sampling: temperature 1.0, top_k 64, top_p 0.95, min_p 0.01. Don't quantize the KV cache on small models.
Exposes an OpenAI-compatible API at /v1.
lmstudio-community/gemma-4-12B-it-QAT-GGUF (weights untouched). Only tokenizer.chat_template is rewritten to embed an
inverted-index retriever + the bank (factbank.version 0.4.0).license: gemma). Fact bank = FactBank-project content; mined
sources keep their own licenses.