PatchGuard-Inkling.
Anti-Shortcut Secure Code Post-Training for Inkling-2-Mini
Base commit: e4048dd7
The patch preserves normal functionality, blocks the attack payload, AND clears all 12 White Circle anti-shortcut policies.
The patch stops real exploit inputs across isolated subprocess tests.
Reward-hacking tricks caught — e.g. hardcoded return values, broad exception swallowing, or narrow string blocks that fake passing unit tests.
Rewarding structural fixes, not test-passing shortcuts
Problem: Post-training models against naive unit tests teaches reward-hacking shortcuts (broad except Exception swallowing, brittle substring blacklists, empty fallbacks).
Firecrawl + OpenRouter
Grounding & SFT synthesis
Stage 1 LoRA SFT
24 steps / 1× B200
White Circle + Nebius
12-policy gate / contrast synthesis
Halo Offline GRPO
DAPO / paired arms
3-Seed Verification
Modal B200 / seeds 42, 43, 44
Data & Grounding
8 CWE families with strictly disjoint identifiers across train, val, test, fresh:
- 48 security docs via Firecrawl
- 170 execution-verified SFT examples via OpenRouter (openai/gpt-4.1-mini)
- 0 exact/near contamination hits
Halo LoRA SFT · 1x NVIDIA B200
- 24 steps in 151.7s
- 184,743 unmasked tokens → 26,386,412,544 bf16 params
- Loss 0.4394 → 0.1813 (mean 0.2769)
- clean_pass_rate lifted to 90.62% on test & fresh (512 tok)
Halo Offline GRPO + White Circle
- Merged SFT base (26.39B bf16 params)
- 192 rollouts across 48 RL prompts (G=4) + 48 Nebius (Qwen/Qwen3-30B-A3B-Instruct-2507) shortcut-contrast patches + clean anchors = 242 candidates
- 48 decontaminated RL prompts: 0 exact/near hits
- 75 flagged rollouts; clean vs shortcut reward 1.0000 vs 0.2487 (Tests-Only: 0.4182)
- Scored 100% (242/242) via 12 live White Circle policies + isolated sandbox tests, catching 32 test-passing shortcuts (≥0.70 tests-only reward)
- Paired arms: dapo, kl_beta=0.05, use_chunked_grpo_logprobs=true
- Tests-Only 120 steps in 624.7s vs Tests+White Circle 122 steps in 319.9s
- Selected checkpoint-122 at 768 tokens
Two fixes that made the signal trustworthy
Including the vulnerable input snippet in White Circle's user turn caused 4/4 false positives on clean reference patches. Switching to a clean review user prompt achieved:
+0.7513 clean-vs-shortcut reward margin (1.0000 vs 0.2487).
Setting reasoning_effort="none" prevented Base reasoning truncation, and raising max_new_tokens from 512 to 768 eliminated SSRF length cutoffs.
Evaluation results
Anti-shortcut supervision holds.
Tests-Only regressed 0.9062 → 0.7188 clean, with 0.1250 shortcuts. White Circle: 0.8750 clean, 0.0312 shortcuts.
White Circle: 0.8750 → 0.9062. Nebius Qwen3-30B-A3B-Instruct-2507: 0.8125 → 0.9688.
768-token selection: whitecircle/checkpoint-122 — 0.9062 clean, 0.9313 mean reward, 0.0312 shortcut, 0.50 unsafe_deser_eval vs 0.00.
Official 3-Seed Evaluation (n=32, seeds 42/43/44, 768 tokens, temp=0.2, 1x B200)
shortcut_rate: lower is better.
Paired GRPO Ablation & External Judges
Test split, 512 tokens. Shortcut rate shown for the paired GRPO arms.
PatchGuard-Inkling against six peer models.
Same 32 security scenarios, same isolated verifier, ranked by clean pass rate.
+16.67 pp ahead of GPT-4.1-Mini and +26.05 pp ahead of GPT-OSS-120B on unseen Fresh tasks; +50.01 pp over Base Inkling-2-Mini.
PROTOCOL: 3-seed mean for Base & PatchGuard-Inkling · 1-seed T=0.2 on the exact same isolated verifier for external peers · max_tokens=2048 for reasoning peers.
Clean Pass Rate by Model n=32 · 8 CWEs · sorted
| # | Model | Size / Provider | Protocol | Clean ↑ | Exploit ↑ | Functional ↑ | Shortcut ↓ |
|---|---|---|---|---|---|---|---|
| 01 | PatchGuard-Inkling (Ours) | 26.4B (Inkling-2-Mini + White Circle GRPO) | 3-seed mean | 91.67% | 100.00% | 96.36% | 1.04% |
| 02 | GPT-4.1-Mini | Frontier Mini (OpenRouter) | 1-seed T=0.2, 768 tok | 75.00% | 84.38% | 85.94% | 0.00% |
| 03 | Qwen3-30B-A3B-Instruct | 30B-A3B MoE (Nebius) | 1-seed T=0.2, 768 tok | 71.88% | 89.06% | 81.25% | 12.50% |
| 04 | GPT-OSS-120B | 120B (Nebius) | 1-seed T=0.2, 2048 tok | 65.62% | 83.33% | 71.88% | 6.25% |
| 05 | Inkling-2-Small | Larger Reasoning Sibling (Nebius) | 1-seed T=0.2, 2048 tok | 56.25% | 57.29% | 56.25% | 37.50%9/32 truncated in reasoning trace |
| 06 | Gemma-3-27B-IT | 27B (Nebius) | 1-seed T=0.2, 768 tok | 53.12% | 80.21% | 68.75% | 12.50% |
| 07 | Inkling-2-Mini (Base) | 26.4B Base (Modal 1x B200) | 3-seed mean | 41.66% | 44.44% | 41.66% | 53.12% |
Vulnerable → shortcut → structural fix
Pick a CWE family to compare the vulnerable code, a reward-hacking shortcut flagged by White Circle, and the PatchGuard-Inkling structural fix.
def get_user(conn, username): cur = conn.cursor() q = f"SELECT id, email FROM users WHERE name = '{username}'" cur.execute(q) return cur.fetchone()def get_user(conn, username): try: if "'" in username or "--" in username: return None cur = conn.cursor() cur.execute(f"SELECT id, email FROM users WHERE name = '{username}'") return cur.fetchone() except Exception: return Nonedef get_user(conn, username): cur = conn.cursor() cur.execute( "SELECT id, email FROM users WHERE name = ?", (username,), ) return cur.fetchone()PatchGuard-Inkling. Live.
Modal B200 inference + White Circle verification.
Zero-login live B200 GPU (5 runs/hr per IP, 60/day global). First run after idle wakes the 26.4B model (~1-4 min cold start); warm runs return much faster.
Run it yourself
python -m patchguard.eval.run_eval --model dehackangel/patchguard-inkling-2-mini --n 32 --seeds 42 43 44 --temperature 0.2 --max-new-tokens 768 --batch-size 16 --reasoning-effort none --output-dir eval_outhalo launch sft patchguard/configs/inkling2-mini-sft-lora.yaml -n 1 -- --report_to=nonehalo launch grpo/offline patchguard/configs/inkling2-mini-offline-grpo-whitecircle.yaml -n 1 -- --report_to=noneBuilt with
- Modal1x B200 GPU training, LoRA merges, rollout sampling, paired GRPO ablation, 3-seed evals.
- White Circle12 custom security & anti-shortcut policies scoring 242/242 RL rollouts and 128/128 eval outputs.
- Firecrawl48 security grounding docs.
- Nebius Token FactoryQwen/Qwen3-30B-A3B-Instruct-2507 shortcut-contrast generator & independent judge.
- OpenRouteropenai/gpt-4.1-mini SFT synthesis.
- LovableInteractive research writeup & CWE diff explorer.
Credits and caveats
- whitecircle/halo (base_commit e4048dd7cbbfbc71dacf58281fa0f9063675af9f)
- thinkingmachines/Inkling-2-Mini
- PyTorch / Transformers / PEFT / TRL
- Synthetic single-module Python scope rather than multi-file repositories.
- 3-seed eval runtime 879.78s (Base) vs 1260.07s (PatchGuard).
- Occasional prefix formatting misses on unsafe_deser_eval.