A rank-32 LoRA adapter for Qwen/Qwen3-4B that repairs small C functions with one security bug. It was built for the LLMs for Security Engineers course by Secure AI (thomas@secureai.se), where students compare it with the GRPO runs they train themselves.
Prompt (no thinking): This C function has a security bug. Fix it with the smallest change. Reply with only the complete fixed function (including any struct or #include lines it needs) in one ```c code block. followed by the
function in a ```c block.
116 held-out bugs (never trained on) × 8 fixes at temperature 0.8, scored with the course lab's checker:
| model | fixes passing every check (pass@1) | bugs with a passing fix in 8 (pass@8) |
|---|---|---|
| Qwen3-4B | 0.247 | 0.371 |
| + SFT | 0.483 | 0.879 |
| + SFT, then GRPO (this adapter) | 0.509 | 0.897 |
Scope: the held-out bugs come from the same synthetic generator and 15 bug classes as the training bugs, so this is in-distribution. "Fixed" means the trigger input runs clean and 2–4 normal inputs still print the right output; it is not a proof that every attack input is handled. Not tested on real-world CVEs. Run model-written code only in a sandbox.
from vllm import LLM, SamplingParams
from vllm.lora.request import LoRARequest
llm = LLM(model="Qwen/Qwen3-4B", enable_lora=True, max_lora_rank=32)
out = llm.chat([{"role": "user", "content": prompt}], SamplingParams(temperature=0.8, max_tokens=1024),
lora_request=LoRARequest("repair", 1, "/path/to/qwen3-4b-c-repair-lora"),
chat_template_kwargs={"enable_thinking": False})
Qwen/Qwen3-4B