Team Ai
Modelpublic

jaimef21/security-lora-qwen2.5-coder-3b-gguf

sourceHugging Faceapache-2.0updated 5mo agoView on Hugging Face
0likes81downloads
Model Card

security-lora-qwen2.5-coder-3b-gguf

GGUF quants of jaimef21/security-lora-qwen2.5-coder-3b-bf16, a Qwen2.5-Coder-3B-Instruct LoRA fine-tune for detecting malicious npm / PyPI supply-chain attack code.

Outputs a structured JSON verdict with cited line ranges. Tuned via DPO to suppress false positives on legitimate minified / telemetry / crypto code.

Training pipeline: <https://github.com/jaimef21/security-lora>

Files

FileQuantSizeNotes
security-lora.q8_0.ggufQ8_0~3.2 GBHigh fidelity; indistinguishable from F16 for most use
security-lora.q4_k_m.ggufQ4KM~1.9 GBRuns comfortably on an 8 GB laptop or 4 GB CPU server

Usage with llama.cpp

bash
./llama-cli -m security-lora.q4_k_m.gguf \
    -p "Analyze this code for malicious behaviour. Source: \`example.js\`.\n\n\`\`\`js\nconst x = require('child_process').exec(process.env.CMD);\n\`\`\`"

Usage with Ollama

Build a Modelfile locally:

FROM ./security-lora.q4_k_m.gguf

SYSTEM "You are a security analyst. Given a source code file, return a JSON verdict {verdict, confidence, categories, reasoning, iocs} for whether the code is malicious. verdict ∈ {malicious, suspicious, benign}. Always cite specific line ranges in iocs.lines when flagging behaviour. Be precise and concise."

PARAMETER temperature 0.1
PARAMETER num_ctx 8192
PARAMETER stop "<|im_end|>"

Then:

bash
ollama create security-scan -f Modelfile
ollama run security-scan "Analyze this code..."

Output schema

json
{
  "verdict": "malicious | suspicious | benign",
  "confidence": 0.0,
  "categories": ["env_exfil", "crypto_miner", "backdoor", "typosquat",
                 "install_hook_abuse", "obfuscated_eval", "c2_beacon",
                 "credential_theft", "protestware"],
  "reasoning": "step-by-step taint flow / deobfuscation walkthrough",
  "iocs": {"domains": [], "files": [], "lines": [], "env_vars": []}
}

Training pipeline

  1. 1.CPT — Continued pre-training on Datadog malicious-packages + Advisory DB + Semgrep registry.
  2. 2.SFT — Teacher-labeled verdicts (Qwen3-Coder-480B-A35B-FP8) on confirmed-malicious + popular-benign npm samples.
  3. 3.DPO — 300 benign-lookalike pairs to suppress false positives on minified bundles, telemetry SDKs, real crypto.