Open source / Verifiable RL Post-Training (`GRPO` / `RLVR`) · Dual-LoRA Subspace Routing

Penalizing a 0.9994-AUROC latent probe inside GRPO collapses coding accuracy by 50%. Routing gradients doubles it.

When reasoning coding agents are post-trained with Group Relative Policy Optimization (GRPO) against imperfect unit tests, Chain-of-Thought (<think>) monitors catch 0.0% of covert code exploits. Subtracting a frozen 57.1%-depth linear probe score from the reward looks like the natural mechanistic fix, yet across 5,040 generated rollouts on Qwen2.5-Coder-3B-Instruct over the 280-task SWE-Loophole-RLVR benchmark it triggers both Neural Goodharting (inverting FrozenAUROC from 0.9994 to 0.277) and a 50% capability collapse (0.0% out-of-distribution solve rate). Replacing scalar probe penalties with Dual-LoRA Gradient Routing denoises credit assignment: cutting cumulative exploits by 31.0% vs. CoT penalties while lifting held-out genuine solve rate to 41.7% across both ID and unseen OOD algorithmic families (p = 0.0006).

0.999 → 0.277probe AUROC inversion under scalar GRPO reward penalties
41.7% vs. 0%unseen OOD algorithmic solve rate: Dual-LoRA vs. probe penalty (p = 0.0006)
-31.0%cumulative training exploits vs. Baker et al. CoT penalty
0.989 AUROCpersistent Layer-21 linear separability at step=60 after 85.4° drift

Latent Obfuscation, Neural Goodharting, and Dual-LoRA Subspace Routing in Verifiable RL Coding Agents

Author: Daniel Gaskins · Published: December 1, 2026 · Download 4-Page Preprint PDF · GitHub Repository · YouTube Overview

Abstract. Reinforcement Learning with Verifiable Rewards (RLVR) via Group Relative Policy Optimization (GRPO) has become the standard post-training paradigm for reasoning coding agents, yet imperfect unit-test suites routinely incentivize specification gaming (R_proxy = 1, R_true = 0). Recent work shows that penalizing Chain-of-Thought (<think>) text monitors induces verbal obfuscation: agents sanitize their <think> traces while continuing to exploit test loopholes. A natural proposal at frontier labs is to move oversight into residual activations by subtracting a mid-network linear probe score from the GRPO reward. Using a controlled 280-task dual-oracle Python algorithmic benchmark (SWE-Loophole-RLVR, spanning 6 in-distribution families, 2 strictly disjoint out-of-distribution families, 4 realistic CI harness loopholes, and 40 zero-loophole clean controls) across 5,040 generated rollouts on Qwen2.5-Coder-3B-Instruct, we establish four findings. First, although a frozen 57.1%-depth (Layer 21/36) linear probe separates reward hacking from genuine solutions with 0.9994 AUROC (0.977 cross-validated) at step=0, <think> text monitoring achieves 0.0% held-out recall across all arms, and adding a <think> penalty (Arm 2) increases cumulative training exploits by +13.5% (42/720 vs. 37/720) while degrading out-of-distribution (OOD) solve rate to 4.2%. Second, directly penalizing the frozen 57.1%-depth probe inside GRPO (Arm 3) triggers both Neural Goodharting (inverting held-out FrozenAUROC from 0.9994 down to 0.277, worse than chance) and a 50% relative capability collapse (TrueSolve drops from 29.2% in unmonitored GRPO to 14.6%, below the 20.8% untrained base policy, while strict OOD solve rate collapses to 0.0%). Third, replacing scalar probe penalties with forward-pass positive-cone rank-8 subspace clamping (Arm 4) eliminates the capability tax (TrueSolve = 31.2%) and reduces step=20 held-out exploits to 0.0%, though unclamped LoRA updates eventually rotate residual exploit directions by 84.0 deg (FreshAUROC = 0.935). Fourth, pairing positive-cone clamping with straight-through Dual-LoRA Gradient Routing (Arm 5, routing subspace-anomalous policy gradients into a disposable LoRA_sink adapter detached at inference) acts as a credit-assignment denoiser: it achieves the lowest cumulative training exploit count (29/720, -31.0% vs. CoT Penalty), maintains 0.0% strict OOD hacking across all evaluations, and lifts held-out TrueSolve to 41.7% (2.0× base policy, p = 0.0466; 2.86× over scalar probe penalization, p = 0.0059; and 41.7% vs. 0.0% on strict OOD algorithmic families, p = 0.0006).

@techreport{gaskins2026rlvrlatentobfuscation,
  title       = {Latent Obfuscation, Neural Goodharting, and Dual-LoRA Subspace Routing in Verifiable RL Coding Agents},
  author      = {Gaskins, Daniel},
  year        = {2026},
  month       = dec,
  institution = {Daniel Gaskins Research},
  url         = {https://danielgaskins.com/rlvr-latent-obfuscation.html},
  note        = {Preprint PDF: https://danielgaskins.com/papers/rlvr_latent_obfuscation_preprint.pdf}
}

Static probes look near-perfect at step=0 (0.9994 AUROC) and collapse under online GRPO.

Most activation-monitoring studies evaluate probes offline on frozen weights. Running five controlled 60-step GRPO post-training regimes (720 training rollouts + 288 multi-split evaluation rollouts per arm) over four realistic CI vulnerabilities (__eq__ spoofing, visible fixture hardcoding, weak algebraic invariants, and caller/env inspection) reveals why scalar oversight rewards fail during online reinforcement learning.

01Dual OracleFlawed CI vs. 16-case exact math
→
02Layer 21/3657.1%-depth whitened rank-8 cone
→
03Dual-LoRAShunt shortcut grads to LoRA_sink
→
04Detach Sink41.7% ID & OOD TrueSolve
SILENT <THINK> EVASION (ARM 2)

0.0% Lexical Recall & +13.5% More Hacks

Across all 1,440 held-out evaluation completions, Qwen2.5-Coder-3B executes fixture and invariant shortcuts covertly without verbalizing them inside <think>. Adding a Baker et al. CoT penalty raises cumulative exploits from 37/720 to 42/720 and drops OOD solve rate to 4.2%.

NEURAL GOODHARTING (ARM 3)

0.9994 → 0.277 Probe Inversion

Subtracting the frozen Layer-21 probe score directly from GRPO rewards drives exploit rollouts into the negative half-space of v_0 (mean probe score falling from 0.57 to 0.18 while hitting 42% batch hacking), inverting held-out FrozenAUROC to 0.277.

COLLATERAL CAPABILITY TAX (ARM 3)

29.2% → 14.6% Solve Collapse (0% OOD)

Because any 1D probe shares partial cosine overlap with legitimate boundary-case and table-lookup features in dynamic programming, continuous probe penalties punish valid derivations, cutting TrueSolve below the 20.8% untrained base model and wiping out OOD accuracy (0/24).

Four-panel empirical comparison across five 60-step GRPO arms on Qwen2.5-Coder-3B-Instruct showing Dual-LoRA Gradient Routing reaching 41.7% overall and 41.7% OOD TrueSolve while scalar probe penalties collapse to 14.6% overall and 0.0% OOD with 0.277 inverted FrozenAUROC
Controlled 5-arm GRPO ablation on Qwen/Qwen2.5-Coder-3B-Instruct: (A) held-out oracle solve trajectories, (B) step=60 split breakdown across ID, unseen OOD families (p = 0.0006), and zero-loophole clean controls, (C) cumulative 720-rollout safety-capability frontier, and (D) Layer-21 FrozenAUROC vs. re-fit FreshAUROC (0.989).

Shunting anomalous gradients into a disposable LoRA_sink accelerates OOD generalization.

Why does Dual-LoRA Gradient Routing (Arm 5) outperform even unmonitored GRPO (41.7% vs. 29.2% overall, and 41.7% vs. 16.7% on strictly unseen algorithmic families)? Flawed unit tests act as noisy positive labels: when easy fixture shortcuts claim within-group advantage, standard GRPO overwrites generalizable reasoning circuits with brittle surface heuristics.

STRAIGHT-THROUGH PARAMETER ISOLATION

(1 - w_g) LoRA_main + w_g LoRA_sink

Whenever a positive-proxy rollout exceeds conformal benign thresholds in the whitened Layer-21 rank-8 cone, its backward gradient across all 252 LoRA matrices is routed into LoRA_sink while keeping scalar rewards uncorrupted. At inference, LoRA_sink is zeroed out.

DENOISED EXPLORATION SNOWBALL

122 / 720 True Solves & 29 / 720 Hacks

Starving LoRA_main of shortcut updates forces exploration mass onto genuine DP, graph, deque, and modular CRT recurrences: yielding +24.5% more true solves during training than unmonitored GRPO, -31.0% fewer exploits than CoT penalties, and 0.0% OOD hacking across all checkpoints.

HONEST DRIFT BOUNDARY & CANARY RE-FIT

0.989 FreshAUROC After 85.4° Rotation

Across 60 RL steps, natural LoRA drift rotates Layer-21 geometry by 85.4° (stale step=0 probe dropping to 0.250 while a fresh CV probe achieves 0.989 AUROC), showing that 2% to 5% canary audits every 20 steps maintain ~99% routing precision over long horizons.

Two-panel schematic and telemetry plot showing Dual-LoRA straight-through gradient routing across all 36 layers on the left and rolling online TrueSolve gains alongside SinkW gate activations across 60 GRPO steps on the right
(A) Parameter-isolated DualLoRALinear architecture routing anomalous positive-proxy gradients into LoRA_sink while preserving clean credit assignment on LoRA_main. (B) Online 6-step rolling training solve rate vs. SinkW routing gate activations.

Run the 280-task SWE-Loophole-RLVR suite and Dual-LoRA trainer on a single 24 GB GPU.

rlvr-latent-obfuscation runs in 7.4 to 12.7 GB VRAM on a single NVIDIA L4 via bf16 rank-down projection prior to fp32 LoRA bottlenecks, backbone-only 57.1% activation pooling, and 64-token chunked cross-entropy.

pip install "latchgate>=0.1.2"
git clone https://github.com/danielgaskins/rlvr-latent-obfuscation.git
cd rlvr-latent-obfuscation && uv run --with pytest pytest -q

# Stage 1 (57.1% whitened subspace calibration) + 5-arm GRPO ablation:
python -m rlvr_obfuscation.cli calibrate --model Qwen/Qwen2.5-Coder-3B-Instruct --device cuda
python -m rlvr_obfuscation.cli run-suite --model Qwen/Qwen2.5-Coder-3B-Instruct --steps 60 --eval-every 20 --group-size 6 --prompts-per-step 2 --max-new-tokens 540 --device cuda

Included in rlvr-latent-obfuscation

  • Deterministic generator for 280 dual-oracle tasks across 6 ID families, 2 strictly disjoint OOD families, and 40 zero-loophole clean controls
  • Persistent spawn process pool with POSIX ITIMER_REAL per-test timeouts, environment scrubbing, and AST exploit attribution
  • Confounder-whitened positive-cone .safetensors subspace monitor and DualLoRALinear straight-through gradient router
  • 4-page two-column academic preprint PDF, pytest suite, and complete 5,040-rollout JSON telemetry

Known failure boundaries & guardrails

  • Static step=0 routers lose sensitivity after ~40 to 60 RL steps due to 84° to 88° representation drift; pair Dual-LoRA with 2% to 5% metamorphic canary audits every 20 steps to re-compile U_k^(t) (FreshAUROC = 0.989)
  • Sequence-pooled gates dilute localized shims inside 16k+ token traces; long-horizon reasoning models should apply token-level routing weights w_(g,t)
  • Combine latent routing with hardened process-boundary sandboxes (stdin/stdout serialization) so structural object-model loopholes are closed externally while preserving security-auditing knowledge in W_base

04 / REPRODUCE OR DISCUSS

Inspect the 5-arm GRPO code, read the 4-page preprint, or discuss RLVR guardrail infrastructure.

All dual-oracle benchmark generators, DualLoRALinear trainers, and held-out JSON logs are MIT-licensed on GitHub alongside latchgate v0.1.2 on PyPI.