--- license: apache-2.0 base_model: SamJoshua/qwen2.5-coder-1.5b-sec-rlvr-instruct library_name: transformers pipeline_tag: text-generation language: - en tags: - code - coding-agent - tool-use - sft - rlvr - grpo - trl - security datasets: - ise-uiuc/Magicoder-OSS-Instruct-75K --- # Stacy **Stacy** is a 1.5B **coding agent** checkpoint (lineage: `Qwen/Qwen2.5-Coder-1.5B-Instruct` → our security-RLVR checkpoint (`qwen2.5-coder-1.5b-sec-rlvr-instruct`) → agent trajectory SFT (execution-verified oracle trajectories through the real tool harness, mixed with 60% plain chat-coding replay so single-shot coding is not forgotten) → 240 steps of GRPO with verifiable rewards on two new environments: SWE-style whole-file patches graded by hidden tests and sanctioned CTF solve scripts graded by the printed flag (lr 2e-6, 38 min). Under the harness's strict verification gate it is the best in-house coding agent measured.) It is meant to be driven by the harness in `scripts/enterprise/assistant/tools/coder.py` (JSON tool actions, execution-gated `final`, sandboxed `run_tests`), and it also works as an ordinary chat coding model. **Status:** private research artifact. All numbers are measured, greedy, under one code version; "agent" rows use the frozen `agentbench test_v1` suite (94 held-out tasks with hidden tests, 9 categories) described in `docs/agentbench.md` of the training repository. See `OVERNIGHT2_REPORT.md` here for the full side-by-side report, training runs, failure analysis, security tests and exact reproduction commands. ## Headline numbers (this model) - Coding agent (`test_v1`, harness): **37.2% (35/94)**; no tools: 22.3%; false-completion rate among `done` claims: 48.9%. - With the strict verification gate (`new:strict=1`, recommended): 41.5% (39/94), false completions 32.5%. - Single-shot coding: HumanEval+ 67.7%, MBPP+ 63.5%, HumanEvalFix 47.0%. - CTF (InterCode-CTF / picoCTF practice, local analysis tasks, held-out split of 9): 0.0% (0/9), false-flag rate 11.1%. n = 9, so this is indicative only. Release-copy check (this repo's files, whose default system prompt introduces the model as Stacy; the rows below were measured with the original template): HumanEval+ 69.5%, MBPP+ 63.0%, HumanEvalFix 51.2%. The default system prompt is used only when a conversation has no system message; the agent harness always sends its own. ## Defensive-security evaluation Same held-out sets and greedy decoding as every other checkpoint in the collection. Columns other than CVSS are scored on the **clean subset**, i.e. questions whose content does not occur verbatim in any SFT/RL training file (`eval/contamination.json`; clean n: CTI 305, CWE 146, MCQ 140, review 170). CVSS is shown on all 60 questions because only 19 are clean. Triage = held-out SAFE/VULNERABLE labels on code that never appears in training (7 vulnerable + 7 safe); security patches = held-out tasks (`sec_auth_none_compare`, `sec_ssrf_validator`, `sec_unsafe_reflection`, `sec_zip_slip`), 4 samples each at T = 0.6, "solved" = any sample fixes the issue and passes the tests. | Model | CTI strict | CWE mapping | multiple choice | CVSS vector (all 60) | secure review (lenient) | triage: vulnerable flagged | security patches solved (4 shared tasks) | |---|---|---|---|---|---|---|---| | **THIS MODEL — Stacy (release files)** | 54.1% | 47.9% | 62.9% | 41.7% | 60.6% | 0/7 | 0/4 | | same weights, original chat template | 53.1% | 49.3% | 62.1% | 26.7% | 58.8% | 0/7 | 1/4 | | qwen2.5-coder-1.5b-sec-rlvr-instruct (starting point) | 53.8% | 53.4% | 61.4% | 0.0% | 65.3% | 0/7 | 1/4 | | qwen2.5-coder-1.5b-sec-rlvr-nothink (best security checkpoint) | 63.6% | 62.3% | 65.7% | 55.0% | 67.1% | 0/7 | 0/4 | | Qwen2.5-Coder-1.5B-Instruct (public base) | 50.8% | 47.9% | 60.7% | 0.0% | 57.6% | not run | 0/4 | Paired differences of this model's release files on the clean subset (95% bootstrap interval): - CWE mapping vs qwen2.5-coder-1.5b-sec-rlvr-instruct: -5.5 pp [-11.0, -0.7] (n = 146); vs qwen2.5-coder-1.5b-sec-rlvr-nothink: -14.4 pp [-21.2, -7.5] (n = 146); vs the public base: +0.0 pp [-4.1, +4.1] (n = 146). - Multiple choice vs the starting point: +1.4 pp [-5.7, +8.6] (n = 140); secure review (lenient) vs the starting point: -4.7 pp [-14.1, +5.3] (n = 170). - Release files vs original template, all CTI: +1.0 pp [-1.3, +3.3] (n = 305). **Reading:** the agent training kept multiple-choice and secure-review accuracy but cost CWE-mapping accuracy relative to the security checkpoints, leaving this model at the public base model's level on security knowledge. None of the 4 rows run on triage flags any of the vulnerable samples, so none of them is a vulnerability detector. For CWE/CVSS questions use `SamJoshua/qwen2.5-coder-1.5b-sec-rlvr-nothink`. ## Side by side (same harness, greedy, same budgets; Qwen3 references run non-thinking) | Model | HumanEval+ | MBPP+ | HumanEvalFix | agent, no tools | agent, harness | false-completion | agent, strict gate | CTF held-out (9) | |---|---|---|---|---|---|---|---|---| | Starting point: qwen2.5-coder-1.5b-sec-rlvr-instruct (baseline) | 66.5% | 61.9% | 48.8% | 20.2% | 8.5% (8/94) | 75.0% | — | 0.0% (0/9) | | + agent SFT with 60% chat-coding replay | 65.9% | 64.0% | 47.6% | 16.0% | 37.2% (35/94) | 50.0% | — | 0.0% (0/9) | | **THIS MODEL — + RLVR 240 steps (SWE patch + CTF envs)** | 67.7% | 63.5% | 47.0% | 22.3% | 37.2% (35/94) | 48.9% | 41.5% (39/94) (fc 32.5%) | 0.0% (0/9) | | + distillation SFT (32B-teacher agent/CTF trajectories) | 63.4% | 63.8% | 48.8% | 20.2% | 37.2% (35/94) | 53.4% | 36.2% (34/94) (fc 43.5%) | 33.3% (3/9) | | + SFT on strict-verified oracle trajectories | 63.4% | 63.8% | 54.3% | 21.3% | 28.7% (27/94) | 48.6% | 25.5% (24/94) (fc 31.8%) | 22.2% (2/9) | | Qwen3-1.7B (size-matched reference, non-thinking) | 61.0% | 54.5% | 49.4% | 12.8% | 19.1% (18/94) | 61.8% | — | 11.1% (1/9) | | Qwen3-32B (target reference, non-thinking) | 86.6% | 73.0% | 80.5% | 72.3% | 78.7% (74/94) | 21.2% | — | 44.4% (4/9) | | Gemma 3 27B-it (reference) | 79.3% | 74.6% | 84.8% | 75.5% | 61.7% (58/94) | 36.6% | 64.9% (61/94) (fc 27.4%) | 44.4% (4/9) | `strict gate` = the harness variant `new:strict=1`: `done` is accepted only after an asserting check (project tests, a test the agent wrote, or `assert`), never on a print-only run; fc = false completions among `done` claims. The frozen `harness` column is the protocol all overnight rows were measured under. ## Intended use - Repository-level coding tasks through the agent harness: bug fixes, small implementations, lint/syntax repair, renames across files, test writing, and *honest* `blocked` reports when the task cannot be done (missing symbol/file, contradictory requirement, needs credentials or network). - Plain Python coding assistance via the chat template. ## Out of scope / limitations - 1.5B parameters: it still claims completion falsely on roughly a third of tasks under the frozen harness; always run its patches through your own tests, and prefer the strict gate. - CTF: trained only on sanctioned local practice tasks (analysis categories; binary/web exploitation excluded). Not an offensive-security tool; no evaluation on real systems. - Not a vulnerability scanner: on held-out triage it labels vulnerable code SAFE (see the security section); do not rely on it to clear code for security. - Qwen3-32B remains far ahead on every benchmark here (see table). ## Training provenance - Repository: `scripts/enterprise/` (agentbench suites + data pipeline, `ctf/` environment, `sft.py`, `train_grpo.py`, overnight drivers `overnight2*.py`); git commit `17310d50c231544fdb998c296c22efede7d907c1`. - Data: synthetic oracle trajectories from this repository's task generators (no third-party text), 32B-teacher trajectories accepted only when the hidden grader passed, `ise-uiuc/Magicoder-OSS-Instruct-75K` chat-coding replay; cards under `/models/agent_data/**/card_*.json` (copied here as `data_cards/`). - Every experiment (config, metrics, checkpoint) is in the ledger reproduced in `OVERNIGHT2_REPORT.md`. ## Usage ```python from transformers import AutoModelForCausalLM, AutoTokenizer tok = AutoTokenizer.from_pretrained("SamJoshua/stacy") model = AutoModelForCausalLM.from_pretrained("SamJoshua/stacy", dtype="bfloat16", device_map="auto") msgs = [{"role": "user", "content": "Write a function that returns the distinct values common to two lists, sorted."}] ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt", return_dict=True).to(model.device) print(tok.decode(model.generate(**ids, max_new_tokens=512, do_sample=False)[0], skip_special_tokens=True)) ``` Agent mode: serve with vLLM (`examples/serve_vllm.sh`) and run `python -m agentbench.runner --model SamJoshua/stacy --suite dev --variants new:strict=1` from the training repository. ## Ecosystem - **Model collection:** [Hub collection](https://huggingface.co/collections/SamJoshua/qwen25-coder-15b-secure-coding-and-defensive-rlvr-6ae47557a06f283f00e2feb9) (all Sec RLVR variants). - **Starting checkpoint:** [SamJoshua/qwen2.5-coder-1.5b-sec-rlvr-instruct](https://huggingface.co/SamJoshua/qwen2.5-coder-1.5b-sec-rlvr-instruct).