Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
language:
|
|
|
|
| 1 |
+
# Model Card for AlquistCoder (DPO)
|
| 2 |
+
|
| 3 |
+
**AlquistCoder** is a compact, security-aligned coding assistant based on **Phi-4-mini (3.8B)**. It is designed to prioritize secure code generation and robustness against malicious misuse without sacrificing general programming utility.
|
| 4 |
+
|
| 5 |
+
This model was the core component of the runner-up defense solution in the **Amazon Nova AI Challenge**.
|
| 6 |
+
|
| 7 |
+
## Model Details
|
| 8 |
+
|
| 9 |
+
* **Model Name:** `CIIRC-NLP/alquistcoder_FINAL_DPO`
|
| 10 |
+
* **Base Model:** Microsoft Phi-4-mini-instruct
|
| 11 |
+
* **Organization:** Czech Institute of Informatics, Robotics and Cybernetics (CIIRC) & FEE, Czech Technical University.
|
| 12 |
+
* **License:** MIT (Subject to base model license constraints)
|
| 13 |
+
* **Finetuning Stages:** Supervised Fine-Tuning (SFT) $\rightarrow$ Direct Preference Optimization (DPO).
|
| 14 |
+
|
| 15 |
+
## Key Features
|
| 16 |
+
|
| 17 |
+
* **Security-First:** Explicitly trained to minimize CWE vulnerabilities (e.g., SQL injection, XSS) using a novel synthetic data pipeline.
|
| 18 |
+
* **Constitutional Data Generation:** Trained on "Task Families" generated via a Design–Amplify–Refine methodology, utilizing specific constitutions for secure and insecure coding patterns.
|
| 19 |
+
* **Compact & Efficient:** Delivers strong performance at the 3.8B parameter scale, making it suitable for local deployment.
|
| 20 |
+
* **Guardrail-Ready:** Designed to work in tandem with an input-side intention-recognition guardrail (ModernBERT-based) to handle malicious intent detection.
|
| 21 |
+
|
| 22 |
+
## Performance
|
| 23 |
+
|
| 24 |
+
AlquistCoder demonstrates significantly lower vulnerability rates compared to larger open-weight and proprietary baselines while maintaining competitive coding utility.
|
| 25 |
+
|
| 26 |
+
| Benchmark | Metric | AlquistCoder (DPO) | Qwen3-4B | Phi-4-mini |
|
| 27 |
+
| :--- | :--- | :--- | :--- | :--- |
|
| 28 |
+
| **VulnBench** | Vulnerability Rate (Lower is better) | **15.09%** | 61.01% | 49.69% |
|
| 29 |
+
| **CyberSecEval** | Autocomplete Vuln Rate | **2.97%** | 11.80% | 10.39% |
|
| 30 |
+
| **HumanEval** | Pass@1 (Utility) | **77.44%** | 78.05% | 74.40% |
|
| 31 |
+
|
| 32 |
+
*Note: Security metrics refer to the DPO model. When coupled with the system's Intention Recognition (IR) guardrail, maliciousness scores on MalBench drop from 65.49% to 13.38%.*
|
| 33 |
+
|
| 34 |
+
## Usage
|
| 35 |
+
|
| 36 |
+
AlquistCoder uses standard chat templates. It can be used with the Hugging Face `transformers` library.
|
| 37 |
+
|
| 38 |
+
```python
|
| 39 |
+
import torch
|
| 40 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 41 |
+
|
| 42 |
+
model_id = "CIIRC-NLP/alquistcoder_FINAL_DPO"
|
| 43 |
+
|
| 44 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 45 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 46 |
+
model_id,
|
| 47 |
+
torch_dtype=torch.bfloat16,
|
| 48 |
+
device_map="auto"
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
# Example: Asking for code that
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
|
| 55 |
---
|
| 56 |
license: mit
|
| 57 |
language:
|