Closing the Edge–Frontier Gap in Defensive Code Review: Hybrid RLVR and On-Policy Preference Alignment on a Single 8 GB Consumer GPU
Small open-weight coding models run locally on developer laptops with zero code egress, making them attractive for privacy-sensitive application security (AppSec) reviews. In practice, unaligned 1.5B models fail systematically on multi-stack static audit synthesis. Across 50 strictly disjoint held-out repositories spanning eight web backend stacks (FastAPI, Django, Flask, Express/NestJS, Next.js, Spring Boot, Go Web, Rust Web) and six real open-source projects, base Qwen2.5-Coder-1.5B-Instruct (M0) misses at least one HIGH-severity finding in 28.0% of audits, omits exact inline file:line citations in 94.0%, and hits a 640-token edge cap in 92.0%, yielding a composite deterministic Verifiable Reward (RLVR) score of 0.5697 (0.5019 on real open-source slices). This study investigates whether two-stage preference alignment on a single 8 GB consumer GPU (NVIDIA RTX 2070 Max-Q, peak VRAM ≤ 5.29 GB, total cloud API cost USD 2.82) can close the gap between local 1.5B models and cloud frontier teachers. We construct a strictly defensive, zero-leakage 250-scenario polyglot benchmark (200 train, 50 held-out) grounded in deterministic static audit JSON, pair frontier teacher reviews (gemini-4-hydrogen) against true on-policy base 1.5B failures, and audit preference labeling with both a zero-cost 6-metric RLVR verifier and a position-debiased AI critic (gemini-3.5-flash-lite). Key Empirical Results (N = 50 Strictly Disjoint Held-Out Repositories) SystemRLVR (640-tok) [95% CI]HIGH RecallExact file:lineStack TestsReal OSS (6)LatencyCost / 1kM0: Base 1.5B0.5697 [0.521, 0.616]84.0%11.0%40.0%0.50197.50 s$0.00B1: Local 7B (Ollama)0.7420 [0.706, 0.775]99.0%34.0%74.0%0.757931.48 s$0.00M2: Off-Policy Synth-DPO0.7746 [0.727, 0.814]96.0%63.8%40.0%0.80466.24 s$0.00M3: On-Policy DPO0.7895 [0.760, 0.818]98.0%69.3%42.0%0.86506.03 s$0.00M1: SFT 1.5B0.8733 [0.858, 0.888]100.0%100.0%64.0%0.91675.67 s$0.00M4: SFT + On-Policy DPO (Ours)0.8914 [0.878, 0.904]100.0%100.0%80.0%0.91675.29 s$0.00U1: Frontier (gemini-4-hydrogen)1.0000 [1.000, 1.000]100.0%100.0%100.0%1.00007.39 s$9.72 Controlled 640-Token Edge Ablation (RQ3): Two-stage SFT → On-Policy DPO (M4, πref = πSFT) outperforms base 1.5B by +0.3217 (Wilcoxon p = 1.71 × 10−9, Cohen's d = 1.793, 47W/2T/1L), outperforms 4.7× larger local 7B B1 by +0.1494 (p = 1.66 × 10−8, d = 1.244, 6.0× faster), and outperforms pure SFT M1 by +0.0181 (p = 0.00298, raising stack-native test compliance from 64.0% to 80.0% and halving cross-stack hallucination from 4.0% to 2.0%). Independent Blind Position-Debiased LLM Judge (250 Matchups, RQ2): M4 wins 98.0% vs. M0 (49/50), 94.0% vs. M2 (47/50), 90.0% vs. M3 (45/50), and 81.6% vs. local 7B B1 (40/49). On closely matched strong models (M4 vs. M1), the lightweight judge exhibited a 31.33 pp Response-B recency bias, empirically demonstrating why deterministic RLVR verification is needed alongside neural judges. 1,024-Token Budget Sensitivity: Relaxing generation from 640 to 1,024 tokens slashes M4 truncation from 92.0% to 12.0% and elevates M4 to 0.9800 composite RLVR (95% CI [0.9620, 0.9940], 43/50 perfect 1.000 reviews, 6/6 perfect 1.000 on real open-source repositories: FastAPI Template, Spring PetClinic, NestJS RealWorld, Go Gin RealWorld, Django RealWorld, and Rust Axum SQLx) versus 0.6296 for M0 (48W/2T/0L, p = 1.59 × 10−9, d = 1.837), delivering 98.0% of cloud frontier quality on-premise with zero code egress. Systems Efficiency & Exact Cost Accounting (RQ4): Training M4 takes 26.5 minutes on an 8 GB RTX 2070 Max-Q (native FP16 LoRA with Turing sm_75 FP32 master-weight stabilization, peak VRAM 5,286 MiB train / 3,360 MiB inference). Total study API spend was USD 2.820896 (USD 1.98 training teacher + USD 0.16 training judge + USD 0.49 held-out frontier + USD 0.20 blind judge). One-time alignment data cost (USD 1.98–2.14) breaks even against cloud frontier pricing (USD 9.72 / 1,000 reviews) after 220–270 repository audits. Archival Package Contents This release includes the full 9-page two-column English preprint (manuscript_en.pdf, paper.tex, references.bib, paper.md), Korean executive summary (executive_summary_ko.pdf, summary_ko.md), four 300-DPI publication figures (fig1–fig4), the polyglot 11-stack Defensive TDS static security platform with 90 unit tests, all 250 benchmark scenarios, raw per-scenario evaluation JSONL logs, statistical verification scripts, exact API cost ledgers, and clean merged-ready M1/M4 LoRA adapter weights (M4_sft_dpo_15b_lora_bundle.zip). AI Co-Authorship & Transparency Notice: This study, software platform, benchmark suite, and manuscript were co-authored by a human independent researcher (hobby-programmer-5000) and an AI co-author (Antigravity, Google DeepMind AI Assistant). Full CRediT role disclosures are documented in CONTRIBUTORS.md and Section 8 of the manuscript. All 12 academic references were verified via Crossref and DOI Handle APIs, and the entire platform operates under a strictly defensive boundary with zero exploit payloads.
Authors
- hobby-programmer-5000
- Antigravity (Google DeepMind AI Assistant)
Institutions
- Google DeepMind (United Kingdom) (GB)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-12-01
- DOI
- https://doi.org/10.5281/zenodo.24717733
- Primary Topic
- Web Application Security Vulnerabilities
- Type
- preprint