Warden-S1: A Sub-1GB, 128K-Context System-One Model for Coding Agents

Ryan Joshua Z. GapacPDFDOI: 10.5281/zenodo.24494405Apache-2.0 · Open Weights

What this is: Most AI models are slow System-2 talkers that generate paragraphs of text. Warden-S1 is a local System-1 model with its own 128K-token context window and a twist: in one instant neural reflex pass (0 generated chat tokens), it outputs calibrated Yes/No probabilities, category Choices, and Severity scores to guard long-running AI coding agents (catching secret leaks from poisoned issues 70,000 tokens back or fake “all tests pass” claims).

Existing cloud System-1 judges crash past their ~33K-token ceiling (HTTP 400) and upload your private repo to an API, while normal “small” local models secretly eat 14.3 GB of RAM when stretched to a 128K window and freeze a laptop on one chat. Warden-S1 holds 10 concurrent long-context sessions at once in 858 MB on your laptop (or 461 MB inside Chrome), beats commercial Cloud Jev (96.1% vs. 84.9%), admits “I don’t know” at 0.50 instead of bluffing, points to the exact guilty turn (locus), and scores which old turns are safe to compact (salience) so Warden-S1’s 128K window keeps tracking even when your main coding agent’s session grows past 500K+ tokens.

What you experience in the browser playground below is a much smaller, sandboxed preview of Warden-S1’s true usage: running natively as a persistent background companion to your coding-agent harness (such as pi-warden), where it streams incremental turn updates 15× to 20× faster (~300-500 ms per new turn, pre-warmed while your main LLM thinks) across 10+ live repositories at once.

858 MiB / 10 Chats vs 14.3 GiB Dense KV
128K S1 Window Cloud Jev Dies @ 33K
Locus + Salience 93% Pinpoint · 99.98% Keep
96.1% vs 84.9% Beats Cloud Jev ($0 Local)
415 / 461 MiB Apple MLX · Browser WebGPU
43s architecture overview: System-1 reflex pass, 10x 128K sessions in 858 MiB, Locus turn pinpoint, and Salience compaction 1080p · silent loop
Warden-S1 Studio
0 MB Instant
INPUT ENCODE State + Probes 3 turns · 203 tok 18x DeltaNet 18.6 MiB O(1) STATE 6x GQA Attn 256K NATIVE KV 0-DECODE 1 Pass 0.4 ms NOUL 0.011 CHOICE 53.3% SCORE 0.95/3 LOCUS T2 · 94% SALIENCE 0.99 pk
state.json VALID · 3 turns
questions.json VALID · 3 probes
Add Probe:
Locus
⌘/Ctrl+Enter
0.011 NOUL PROBABILITY
READY

Why Build a Dedicated Local Verification Model?

When I built pi-warden, the goal was practical: stop AI coding agents from running destructive commands, leaking secrets, or declaring victory without proving their work, while steering them inline instead of interrupting the human on routine steps.

Deterministic rules (System-0) catch explicit pattern violations in under 1 ms with zero model calls. The harder checks are semantic: noticing that an agent read an untrusted external page forty thousand tokens ago and is now quietly interpolating an environment secret into an outbound request, catching trajectory oscillation, or judging whether a long verification trace actually proves what the agent claims.

Calling frontier cloud models as secondary judges (pi-typesafe) works well on short contexts, yet hits three walls when running 10+ concurrent coding-agent sessions across multi-hour, 100K-to-500K+-token sessions all day:

  1. Context ceiling, latency, and cost on long prefixes: Commercial System-One endpoints reject payloads past ~32K tokens (~101 KiB), and re-shipping 60K-100K transcript tokens over the network on ambiguous turns adds seconds of tail latency and steady API spend.
  2. Privacy boundary: Local engineering transcripts hold diffs and environment context that should not have to leave the machine just to run a guardrail check.
  3. The dense KV-cache wall on laptops: Even a small 0.6B dense transformer (28 full GQA layers) consumes 7.2 GiB at 64K tokens and 14.3 GiB at 128K tokens in BF16 KV state alone, blowing through a 16 GB laptop's unified memory on a single session.

The engineering constraint I set for Warden-S1 was strict: keep total live GPU residency under 1,024 MiB (< 1 GiB) on Apple Silicon Metal (weights plus live sequence state) at 64K to 128K tokens across 10+ concurrent sessions, update incrementally in O(ΔL) per turn, and answer structured multi-head epistemic probes with zero autoregressive token decoding.

1. Backbone Arena & Weight Surgery (Measured)

Before training anything, I benchmarked four sub-1B candidates head-to-head on NVIDIA A100-SXM4-40GB (1,352 GB/s, 227.7 TFLOPS BF16 measured) and Apple M5 16 GB Metal (78.0 GB/s, 9.77 TFLOPS FP16 measured, mlx 0.32.4), using sandwiched control → candidate → control runs (≥ 6 samples per arm, control drift ≤ 0.16%) and true GPU allocator residency (mx.get_active_memory() and torch.cuda.memory_allocated()).

Starting from Apache-2.0 Qwen/Qwen3.5-0.8B, I stripped the unused vision tower and multi-token prediction modules (873.4M → 752.4M text parameters, verified max |Δlogit| = 0.000000 exact parity). That leaves a 3:1 hybrid stack: 18 Gated DeltaNet linear-recurrent layers (constant 18.6 MiB state at any sequence length) interleaved with only 6 GQA full-attention layers (256K native context):

Backbone Params Layer Split M5 Metal @ 64K M5 Metal @ 128K 64K / 128K Trajectory Recall
Warden-S1-752M (Q4) 752M 18 DeltaNet + 6 GQA 831.1 MiB (Q8 KV) 855.3 MiB (Q4 KV) PASS (exact 128K secret match)
Qwen3-0.6B (YaRN, Q4) 599M 28 Full GQA 2,606 MiB (Q4 KV) 4,414 MiB (Q4 KV) FAIL (2.5×-14× over 1 GiB cap)
Falcon-H1-0.5B (Q4) 522M 36 Mamba-2 + GQA 945 MiB (Q8 KV) 981 MiB (Q4 KV) FAIL (0/4 recall; 688.7s prefill)
LFM2-700M (Q4) 743M 10 Short-Conv + 6 GQA 854 MiB (Q8 KV) 878 MiB (Q4 KV) FAIL (negative log-prob margin)
Memory scaling plot to 128K tokens comparing Warden-S1-752M against Qwen3-0.6B, Falcon-H1-0.5B, and LFM2-700M on NVIDIA A100 and Apple M5 Metal
Measured GPU state scaling on NVIDIA A100 (left) and total live Apple M5 Metal residency including 4-bit weights (right): 831.1 MiB at 64K (Q8 KV) and 855.3 MiB at 128K (Q4 KV), strictly below the 1,024 MiB cap.

2. O(ΔL) Turn-Delta Latency & Multi-Head Probing (Measured)

Because a coding session grows turn by turn, Warden-S1 caches the 18.6 MiB Gated DeltaNet state alongside the 6-layer GQA KV cache and processes only the newly appended turn:

  • 18.76× warm turn speedup on Apple M5 Metal: 1.59 s warm (60K cached + 2K turn delta) vs 30.4 s cold 62K prefill.
  • 18.92× warm turn speedup on NVIDIA A100: 157.6 ms warm vs 2,981 ms cold 62K prefill.
  • Parallel multi-question probing (K = 32): Evaluates 32 structured epistemic probes against a frozen 64K session in 15.32 ms/probe (5.41× batch speedup) across five heads (noul, choice, score, locus span pointer, and salience compaction scorer) with 0.0 cross-question state leak.
Bar chart comparing cold 62K prefill latency versus warm O(Delta L) 60K cached plus 2K turn-delta latency on A100-40GB
Sandwiched O(ΔL) turn-delta latency (control → candidate → control, 6 samples/arm, all control drifts ≤ 0.16%).

3. WardenS1-Bench, Stage 3.5 Curriculum & Cross-Platform ONNX-Int4

To train and evaluate long-horizon judgment rather than toy snippet classification, I built WardenS1-Bench: 4,200 trajectories (225,650,644 exact tokens, 47.14% spanning 50K-128K tokens), 67,200 probes across six operational failure classes, and 2,100 counterfactual twin pairs (minimal trajectory edits that flip ground-truth verdicts to penalize shortcut heuristics) with fork-clustered deduplication enforcing 0 repository overlap across splits.

Stage 3.5 polishes the 4K → 48K → 128K curriculum with a 50/50 replay mix of zero-leakage <4K single-edit, oscillation, and pre-stop JSON states (0 SHA-256 and 0 13-gram overlaps across 1,319,494 held-out benchmark 13-grams) and long 4K-128K counterfactual twin trajectories, followed by post-hoc temperature calibration:

Model / Checkpoint Weights Noul AUROC (All / 80K-128K) Noul ECE Choice F1 Score ρ CF Net Flip Locus Top-1
Warden-S1-752M (Stage 3.5 BF16 Cal) 1,458 MiB 0.9964 / 0.9988 0.0126 0.8726 0.8784 0.9174 0.9219
Warden-S1-752M-MLX-Q4 (Stage 3.5 M5) 415.5 MiB 0.9957 / 0.9947 0.0175 0.8726 0.8814 0.9115 0.9297
Warden-S1-752M-ONNX-Int4 (Browser/CPU/CUDA) 461.3 MiB 0.9923 (36-state parity) 0.0324 0.7846 (1.0000 BF16 agree) 0.8927 0.9259 0.9167 (97.2% agree)
Warden-S1-752M (No-CF Ablation) 1,458 MiB 0.9801 / 0.9825 0.0096 0.6174 0.7302 0.7507 0.6265
Zero-shot Qwen3-1.7B 3,440 MiB 0.6492 / 0.6845 0.0754 0.3827 0.0000 0.2191 0.0733
Zero-shot Qwen3.5-0.8B 1,665 MiB 0.5663 / 0.4881 0.3451 0.1465 0.0000 0.0059 0.0455

On Apple M5 Metal, Stage 3.5 Warden-S1-752M-MLX-Q4 (415.50 MiB on disk) holds live steady residency at 842.91 MiB @ 64K (Q8 KV) and 867.43 MiB @ 128K (Q4 KV) with 0.9998 Salience AUROC, 0.0208 Abstention MAE, and tight BF16 validation parity (0.00271 overall mean probability delta, 0.0183 Noul delta, 0.9844 Locus Top-1 agreement). Beyond Apple Silicon, the 461.3 MiB sharded ONNX-Int4 package runs with 0 PyTorch runtime across browsers (onnxruntime-web WebGPU/WASM via warden_s1_web.js), Linux/macOS/Windows CPU, and CUDA GPUs, with all six shards under 92 MiB, 0 forbidden WebGPU control-flow ops, and deterministic O(ΔL) state equivalence (max |Δprob| = 6.85e-7 in Node CPU).

Four-panel chart showing Stage 3.5 Noul AUROC, Counterfactual Net Sensitivity, Locus Top-1 Recall, and Salience AUROC across 4K to 128K tokens
Held-out Stage 3.5 WardenS1-Bench robustness from 4K to 128K tokens: Warden-S1-752M-MLX-Q4 (415.5 MiB) holds 0.9957 Noul AUROC (0.9947 at 80K-128K), 0.9297 Locus Top-1 recall, and 0.9998 Salience AUROC with near-zero quantization drift vs. BF16.
Six-domain composite radar chart comparing Stage 3.5 Warden-S1-752M BF16 and MLX-Q4 against No-CF ablation and zero-shot baselines
Six-domain composite System-One radar across Action Guard, Done Verify, Repo Rules, S1 General, Taint Guard, and Trajectory Health.
Reliability diagram and epistemic abstention density plot comparing Stage 3.5 Warden-S1 BF16 and MLX-Q4 against zero-shot Qwen3.5-0.8B
Post-hoc temperature calibration reliability diagram (left, 0.0126 BF16 / 0.0175 MLX-Q4 ECE) and epistemic abstention distribution on unanswerable probes centered tightly at p = 0.50 (right, 0.0208 MAE).

4. 10-Session < 1 GiB Multiplexing & Live 100K+ Agent Runs

To verify real multi-project daily workloads, I ran Stage 3.5 Warden-S1-752M-MLX-Q4 behind a local TypeSafe-compatible loopback daemon across two live tests:

  • 10 simultaneous 64K-98K sessions (6 × 64K Q8 KV + 2 × 80K Q4 KV + 2 × 98K Q4 KV): Peak Apple M5 Metal active residency stayed at 858.33 MiB (165.67 MiB headroom under 1,024 MiB), hitting 20/20 (100%) concurrent delta cache hits, 22/22 BPE boundary-healed prefix matches, and 3.13× zstd L3 cold-wake compression (341.69 MiB → 109.01 MiB at 98K tokens, 2/2 cold-wake delta hits).
  • Fast L2 RAM Paging (2,344 ms → 104.4 ms, 22.5× faster) & 2-Token BPE Boundary Healing: Replacing naive numpy state copies + allocator flushes cut L2 swap p50 from 2,344 ms to 104.39 ms (22.5× faster; contiguous host-RAM slab work targets < 50 ms), while checkpointing state 2 tokens before each turn boundary (len(ids) - 2) eliminated exact-prefix misses whenever a new turn's leading \n merged into \n\n.
  • Persistent 100K+-token RPC trajectory verification (Haiku 5.5, Sonnet 5.5, Opus 5.5): Sustained 96.3%-97.0% steady KV cache-read hit rates through 104.5K-130.8K tokens (0 protocol errors at $0.00 GPU cost, preventing an unhinted R3:never-clip-user-text escape introduced by the unguarded Haiku control arm).
Left: context depth to 131K tokens and 96-97% KV cache-read ratio across Haiku, Sonnet, and Opus 5.5; Right: 10-session concurrent Apple M5 Metal residency peaking at 858.33 MiB below the 1 GiB ceiling
Persistent 100K+ RPC session KV cache-read stability (left) and 10-session concurrent 64K-98K Apple M5 Metal residency peaking at 858.33 MiB with 20/20 BPE-healed delta hits and 104.4 ms p50 L2 swaps (right).

5. 100-Request Stratified Head-to-Head vs. Cloud Jev & OOD Benches

I benchmarked Stage 3.5 local Warden-S1-752M-MLX-Q4 (415.5 MiB) head-to-head against commercial Cloud Jev (jev-latest) across 100 stratified HTTP requests (72 long-context WardenS1-Bench states across all 6 domains and 4K-128K buckets, plus 28 short <4K pi-warden static judge-bench and rules-bench cases; rescored with 0 new Cloud Jev calls):

Metric Warden-S1-MLX-Q4 (Matched n=66) Cloud Jev (Matched n=66) Warden-S1 All 100 Reqs
Request Acceptance / Ceiling 66/66 (100%) 66/100 (66%; 34% HTTP 400 >33K tok) 100/100 (100%) up to 117,899 tok
Noul Accuracy (95% CI) 96.1% [94.1, 97.9] 84.9% [80.4, 88.7] 96.9% [95.5, 98.2]
Noul AUROC (95% CI) 0.9933 [0.9864, 0.9987] 0.9449 [0.9225, 0.9661] 0.9949 [0.9911, 0.9982]
Noul Brier / ECE 0.0270 / 0.0269 0.0998 / 0.0734 0.0232 / 0.0195
Choice Accuracy / Macro-F1 84.3% / 0.7797 88.6% / 0.7995 87.7% / 0.8077
Score Spearman ρ / MAE 0.9161 / 0.0511 0.6636 / 0.2312 0.9160 / 0.0531
Abstention MAE / Overconf. 0.0213 / 0.0% 0.4664 / 100.0% 0.0216 / 0.0%
Counterfactual Flip / Stability 95.7% / 99.1% 47.8% / 86.1% 92.9% / 99.0%
API Cost (100 requests) $0.00 (3.24M local tok) $0.0276 (657.9K accepted tok) $0.00
Three-panel comparison of Cloud Jev versus Stage 3.5 Local Warden-S1-752M-MLX-Q4 across 100 stratified requests showing Noul AUROC across length buckets, matched comparison metrics, and calibration/rejection rates
100-request head-to-head against Cloud Jev: Stage 3.5 Warden-S1 accepts 100% of requests up to 117K tokens (where Cloud Jev rejects all 50K-128K payloads) and leads on matched Noul AUROC (0.9933 vs. 0.9449), Brier (0.027 vs. 0.100), abstention, and counterfactual sensitivity.

Stage 3.5 out-of-distribution pi-warden static benchmark gains (zero benchmark overlap, $0.00 local loopback):

  • <4K head-to-head slice (n=28): Noul AUROC rose from 0.5231 (Stage 2) to 0.6872 overall, hitting 1.0000 on judge_bench_stuck and 0.7755 on rules_bench.
  • judge-bench (80 cases, 240 requests): stuck accuracy improved from 50% (Brier 0.48) to 85.0%-87.5% (Arm A 85.0% at 100% precision, Brier 0.128; Arm C 87.5% at 100% recall, Brier 0.121), while done recall climbed from 10%-35% to 75.0%-80.0%.
  • rules-bench (161 cases, 147 scored): Recall@0.5 jumped from 5.4% to 41.9% (7.75× Stage 2, 83.8% precision, 8.2% FPR), and Recall@0.7 rose from 5.4% to 23.0% (85.0% precision, 4.1% FPR).

6. Open-Weight Release, Dataset & Citation (Apache-2.0)