Q4_K_M GGUF + QLoRA)CodePilot Local (dev-ahmad/codepilot-local-1.5b) is a specialized fine-tune of Qwen/Qwen2.5-Coder-1.5B-Instruct built for the Qwen Local Hackathon 2026 (Qwen Pakistan). It transforms a compact 1.5B parameter coding model into a deterministic, 100% offline static analysis and code review engine that outputs strict, machine-parseable JSON diagnostics (line, category, severity, issue, fix) while running in under 1.2 GB of RAM on everyday laptops.
https://github.com/Ahmad1845/codepilot-localdev-ahmad)Qwen2.5-Coder-1.5B-Instruct.Q4_K_M.gguf (940.4 MB)codepilot-1.5b-adapter/adapter_model.safetensors (73.9 MB, r=16, lora_alpha=32)data/train_real.jsonl, data/val_real.jsonl, data/test_real.jsonl (4,546 AST-verified Python samples)Qwen2.5-Coder-1.5B-Instruct frequently wraps answers in conversational Markdown prose (31.7% parse failure rate in automated pipelines) and over-flags clean code (18.5% false positive rate). After QLoRA fine-tuning, CodePilot Local achieves 100.0% Valid JSON Schema Adherence (240/240) and reduces false positives on clean code to 1.67%.N = 240 Held-Out Evaluation Suite)| Metric | Base Qwen2.5-Coder-1.5B-Instruct |
Fine-Tuned codepilot-local-1.5b (Q4_K_M) |
Delta |
|---|---|---|---|
| Valid JSON Output Rate | 68.3% (164/240) |
100.0% (240/240) |
+31.7% |
| Clean-Code False Positive Rate | 18.5% |
1.67% |
-16.6% |
| Security Vulnerability Recall | 54.0% |
89.4% |
+35.4% |
| Line Localization Accuracy (±2 lines) | 49.2% |
86.8% |
+37.6% |
| Overall Defect Detection F1 | 0.584 |
0.887 |
+0.303 |
| Model Size on Disk | 3.20 GB (FP16) |
940.4 MB (Q4_K_M GGUF) |
-70.6% |
| Peak Runtime Memory (RAM) | ~3.80 GB |
~1.15 GB |
-69.7% |
Modelfile)# Run directly via Ollama
ollama run hf.co/dev-ahmad/codepilot-local-1.5b
# Or clone and create from the included Modelfile (pre-configured with strict JSON system prompt & temperature 0.1)
git clone https://huggingface.co/dev-ahmad/codepilot-local-1.5b
cd codepilot-local-1.5b
ollama create codepilot-local -f Modelfile
ollama run codepilot-local
llama.cpp (llama-cli / llama-server)./llama-cli -m Qwen2.5-Coder-1.5B-Instruct.Q4_K_M.gguf \
-c 2048 --temp 0.1 -ngl 99 \
-sys "You are an expert Python code reviewer. Review the provided code snippet for security vulnerabilities, bugs, performance issues, error handling flaws, and resource leaks. Return ONLY valid JSON matching the required schema with line numbers, category, severity, issue description, and fix. Return only raw JSON string, NO markdown code blocks." \
-p "Review this Python code snippet:\n\`\`\`python\n 1 | import subprocess\n 2 | def run_cmd(user_input):\n 3 | subprocess.call(user_input, shell=True)\n\`\`\`"
{
"findings": [
{
"line": 3,
"category": "security",
"severity": "high",
"issue": "Executing subprocess.call with shell=True on untrusted user_input enables arbitrary OS command injection.",
"fix": "Pass arguments as a tokenized list (`shlex.split(user_input)`) with `shell=False`."
}
]
}
When auditing clean, idiomatic code, the model deterministically outputs:
{
"findings": []
}
4,546 AST-Verified Samples)Included directly in this repository under data/:
data/train_real.jsonl (3,540 samples)data/val_real.jsonl (439 samples)data/test_real.jsonl (567 samples)data/DATASET_CARD.md (Full provenance, AST cleaning methodology, and anti-leakage verification)Data Sources:
CyberNative/Code_Vulnerability_Security_DPO (Hugging Face): Real Python vulnerability & patched fix pairs.Dahoas/base_code_review (Hugging Face): Real StackExchange Python code review critiques, HTML-sanitized and AST-validated.psf/requests, pallets/flask, encode/httpx, tiangolo/fastapi, urllib3/urllib3, pallets/werkzeug): Real production functions extracted via Python ast with exact line-numbered defect localization.SFTTrainer) + PEFTQ4_K_M GGUF via llama.cppq_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj2.5471 (Step 10) to 0.0156 (Step 567, Epoch 3.0)eval_loss): 0.5994codepilot-1.5b-adapter/adapter_model.safetensors 70 MiBcodepilot-1.5b-adapter/checkpoint-189/adapter_model.safetensors 70 MiBcodepilot-1.5b-adapter/checkpoint-378/adapter_model.safetensors 70 MiBcodepilot-1.5b-adapter/checkpoint-567/adapter_model.safetensors 70 MiBcodepilot-1.5b-adapter/checkpoint-378/optimizer.pt 36 MiBcodepilot-1.5b-adapter/checkpoint-567/optimizer.pt 36 MiBcodepilot-1.5b-adapter/checkpoint-189/optimizer.pt 36 MiBcodepilot-1.5b-adapter/checkpoint-189/rng_state.pth 14.3 KiBcodepilot-1.5b-adapter/checkpoint-378/rng_state.pth 14.3 KiBcodepilot-1.5b-adapter/checkpoint-567/rng_state.pth 14.3 KiBcodepilot-1.5b-adapter/checkpoint-189/training_args.bin 6.1 KiBcodepilot-1.5b-adapter/checkpoint-378/training_args.bin 6.1 KiBcodepilot-1.5b-adapter/checkpoint-567/training_args.bin 6.1 KiBcodepilot-1.5b-adapter/checkpoint-189/scheduler.pt 1.4 KiBcodepilot-1.5b-adapter/checkpoint-378/scheduler.pt 1.4 KiBcodepilot-1.5b-adapter/checkpoint-567/scheduler.pt 1.4 KiBcodepilot-1.5b-adapter/checkpoint-189/scaler.pt 1.4 KiBcodepilot-1.5b-adapter/checkpoint-378/scaler.pt 1.4 KiBcodepilot-1.5b-adapter/checkpoint-567/scaler.pt 1.4 KiBQwen/Qwen2.5-Coder-1.5B-Instruct