Downloads · 30 days
3
16% of all-time downloads
Mizhhall/qwen2.5-coder-3b-memsafe-v6
qwen2.5-coder-3b-memsafe-v6 is a machine learning model from Mizhhall. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
PiSSA-SFT fine-tune of Qwen/Qwen2.5-Coder-3B-Instruct that performs a structured analysis of a C/C++ fragment and concludes VULNERABLE, NOTVULNERABLE, or INSUFFICIENTCONTEXT with a CWE id.
Downloads · 30 days
3
16% of all-time downloads
All-time downloads
19
Public
Parameters
3.1B
6.2 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors6.2 GB · 100%
From the Hugging Face model README
PiSSA-SFT fine-tune of Qwen/Qwen2.5-Coder-3B-Instruct that performs a structured analysis of
a C/C++ fragment and concludes VULNERABLE, NOT_VULNERABLE, or INSUFFICIENT_CONTEXT
with a CWE id.
Two defining properties:
[MISSING] line naming the exact
external symbol whose value decides safety, plus a conditional verdict ("safe IFF the
capacity of dst covers len"). This turns "I can't tell" into a finding a human can act on
and a ready-made retrieval query for a future agent/RAG layer — no RAG built yet.Code + docs live here (GitHub). Weights and the full dataset are on HuggingFace:
Real-world (PrimeVul/DiverseVul buffer-family), shipped .up6 contract. Full tables:
metrics/RESULTS_V6.txt (v5: metrics/RESULTS.txt).
| split | DECIDED acc / P / R / F1 | CONSERVATIVE recall | abstain% |
|---|---|---|---|
| realworld_test (323) | 0.578 / 0.67 / 0.44 / 0.533 | 0.85 | 74 |
| realworld_benchmark (375) | 0.536 / 0.60 / 0.35 / 0.444 | 0.83 | 74 |
| validation (499) | 0.862 / 0.88 / 0.88 / 0.879 | 0.88 | 18 |
Actionable abstention (the v6 addition): of the rows it abstains on, ~99% emit [MISSING],
60–87% name the specific missing in-code symbol (faithfully), and 62–91% give the
conditional verdict. Inference specificity exceeds the deterministic training labels (56%) —
the model generalized the pattern.
Two scoring modes (data_cleaning/score3way.py): DECIDED = acc/P/R/F1 over rows it commits a verdict on; CONSERVATIVE = abstain-on-a-true-vuln counts as a risk-flag (the security triage metric). Run in CONSERVATIVE mode for triage: ~85% of true vulns flagged, ~5% hard false-positives on safe code.
[SINK] [DESTINATION] [SOURCE] [CONSTRAINTS] [SCRATCHPAD] [MATH] [MISSING] [DECISION] [CONCLUSION]
Run inference under the .up6 contract (scripts/make_up6.py,
data_cleaning/*.up6.jsonl). The system prompt declares the 3-way verdict, the [DECISION]
bridge, and the [MISSING] rule (name the external symbol when abstaining; none otherwise;
[DECISION] is conditional when abstaining). Parse the verdict from [CONCLUSION], the
retrieval target from [MISSING].
data/train/sft_train_v6.jsonl — 4177 rows (V=1282, N=1290, I=1605; abstention 38.4%,
decide VULN:SAFE 0.99:1). Built from the v5 set by enriching every INSUFFICIENT row with a
deterministic, CWE-aware [MISSING] + conditional [DECISION]:
[MISSING] = the declared capacity of the
destination buffer; conditional = "capacity covers the access → NO_DEFECT, else DEFECT_PRESENT".[MISSING] = whether the pointer is still
live; conditional = "not freed → NO_DEFECT, else use-after-free".Only identifiers that appear in the code are named (faithful by construction). The verdicts are unchanged from v5 — v6 only enriches the abstention output. Provenance of the underlying rows (blind 32B-teacher mine + grounding gate + de-risk probe) is unchanged; see metrics/derisk_probe_result.json.
Held-out eval: data_cleaning/{rw_test,rw_bench,val}.bof.jsonl (PrimeVul/DiverseVul, never
in train) → upgraded to .up6 and scored 3-way.
Data sources: NIST Juliet C/C++ 1.3 (https://samate.nist.gov/SARD/test-suites/112,
SHA-256 ada9d7e1c323d283446df3f55bdee0d00bda1fed786785fe98764d58688f38eb, CC0-1.0); PrimeVul
(paired before/after); DiverseVul.
# v5 base pipeline (contrastive mine -> grounded abstention -> assemble -> SFT)
python scripts/build_contrastive_pool.py
python data_cleaning/regen_pipeline.py --model Qwen/Qwen2.5-Coder-32B-Instruct --tp 2 --kbest 4 \
--in data_cleaning/contrastive_mine_input.jsonl --out data_cleaning/contrastive_mined.jsonl
python scripts/build_v5_contrastive.py
python scripts/assemble_v5.py
# v6: enrich abstentions + retrain + eval
python scripts/build_v6_conditional.py # v5 train -> v6 ([MISSING] + conditional, CWE-aware)
python scripts/make_up6.py # .up5 eval splits -> .up6
bash scripts/run_v6_chain.sh # PiSSA SFT v6 + eval (.up6) + score + [MISSING] audit
v6's [MISSING] field is the interface for the next step: an agentic-RAG loop where
INSUFFICIENT_CONTEXT triggers retrieval of the named symbol's definition, then a re-decide. The
recommended first experiment is an oracle probe (give the model the real missing definition,
measure abstention→correct-decision flip-rate) before building any retrieval corpus.
[MISSING] names what's
needed; higher coverage needs inter-procedural context or RAG.confidence= token is uninformative — do not threshold on it.pip install -r requirements.txt
Tuned for a single 48 GB GPU: BF16, PiSSA rank 16, seq 3072. Env vars in
train_qwen_pissa.py override defaults.