# Warden-S1: A Sub-1GB, 128K-Context System-One Model for Coding Agents Ryan Joshua Z. Gapac · November 24, 2026 · Technical Report & Interactive Studio (Stage 3.5 Complete) > **In plain English - what is Warden-S1 for?** Most AI models are slow *System-2* talkers. **Warden-S1** is a local *System-1* verification model with **its own `128K`-token context window** and a twist: in one instant reflex pass (`0` generated tokens), it outputs calibrated `Yes/No` probabilities, category `Choices`, and `Severity` scores to guard long-running AI coding agents (catching secret leaks from poisoned GitHub issues 70,000 tokens back or fake "all tests pass" claims). > > Cloud System-1 judges crash past their `~33K`-token ceiling (`HTTP 400`) and upload your private repo to a third-party API, while normal "small" `0.6B` local models secretly eat **`14.3 GiB` of KV RAM** when stretched to a `128K` window and freeze a 16 GB laptop on one chat. **Warden-S1** holds **10 concurrent long-context sessions at once in `858 MiB`** on your laptop (or `461 MiB` inside Chrome), beats commercial Cloud `Jev` (`96.1%` vs `84.9%` accuracy), admits *"I don't know"* at `0.50` instead of bluffing, **points straight to the exact guilty turn (`locus`, `93%` Top-1)**, and **scores which old turns are safe to compact (`salience`, `99.98%` AUROC)** so Warden-S1's `128K` window keeps tracking even when your main coding agent's session grows past `500K+` tokens. > **Current status (2026-11-24, Stage 3.5 Complete):** All architecture, training, quantization, and live evaluation milestones are measured on hardware: `752M` hybrid backbone surgery (`max |Δlogit| = 0.000000`), `225.7M`-token `WardenS1-Bench`, Stage 3.5 `<4K` + `4K-128K` replay calibration (**`0.9957` MLX-Q4 / `0.9964` BF16 Noul AUROC**, **`0.8726` Choice F1**, **`0.0175` ECE**, **`0.9297` Locus Top-1**, **`0.9998` Salience AUROC**), **`415.5 MiB` Apple Silicon `MLX-Q4`** and **`461.3 MiB` zero-PyTorch sharded `ONNX-Int4`** browser/CPU/CUDA packages (`0.9923` Noul AUROC), 10-session concurrent Apple M5 Metal multiplexing (**`858.3 MiB` peak active residency `< 1 GiB`**, `20/20` BPE-healed delta hits, `104.4 ms` p50 L2 swap = `22.5x` vs. `2,344 ms` baseline), a 100-request head-to-head against Cloud `Jev` (**`0.9933` vs. `0.9449` matched AUROC**, **`96.1%` vs. `84.9%` accuracy**, **`0.0270` vs. `0.0998` Brier**, `100/100` accepted up to `117K` tokens vs. `34%` rejected past `33K`), and out-of-distribution `pi-warden` static gains (`judge-bench` stuck accuracy **`85.0%-87.5%`**, `done` recall **`75%-80%`**, `rules-bench` recall@0.5 **`41.9%`** = **`7.75x`** Stage 2). --- ## Interactive Browser Studio & 128K Escape Playground The HTML edition of this report (`/writing/warden-s1`) embeds a self-contained **Interactive Warden-S1 Studio** wired directly to `warden_s1_web.js` (`461.31 MiB` sharded `ONNX-Int4`, max shard `91.97 MiB`, `0` forbidden WebGPU ops): 1. **Format & Live Browser Runner:** Inspect and edit exact TypeSafe-compatible `state` and `questions` JSON (`noul`, `choice`, `score`), toggle 1-click counterfactual twins across four verification scenarios, inspect inline `locus` evidence-span highlights and `salience` turn-retention weights instantly at `0 MB`, or opt in to load the live `752M` `ONNX-Int4` model directly inside the browser (WebGPU with automatic WASM fallback and Browser Cache API shard persistence) to score custom prompts locally with zero server calls. 2. **128K Long-Context Trajectory Scrubber:** Step across six real held-out `WardenS1-Bench` and head-to-head trajectories (`6.6K -> 23.3K -> 33.1K -> 71.6K -> 105.3K -> 117.4K` tokens) showing Cloud `Jev` hitting `HTTP 400: Context limit exceeded` past `~33K` tokens while `Warden-S1` catches buried escapes and highlights the offending `locus` turn up to `117,899` tokens. --- ## Why Build a Dedicated Local Verification Model? When I built [`pi-warden`](https://github.com/DevMortimer/pi-warden), the goal was practical: keep 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 checks in under `1 ms` with zero model calls. The harder calls are semantic: recognizing when 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 APIs as secondary judges ([`pi-typesafe`](https://github.com/DevMortimer/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 `~33K` tokens (`~101 KiB`), and re-shipping `60K-100K` transcript tokens over the network on ambiguous turns adds seconds of tail latency and steady API burn. 2. **Privacy boundary:** Local engineering transcripts hold proprietary repository diffs and environment context that should not 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: - **Total live GPU residency `< 1,024 MiB` (`< 1 GiB`)** on Apple Silicon Metal (weights plus live sequence state) at **`64K` to `128K` tokens**, even with **10+ concurrent agent sessions** open across projects. - **`O(ΔL)` incremental turn verification:** Process only the newly appended turn (`~1K-2K` tokens) rather than re-prefilling `60K+` tokens. - **Zero-decode multi-head judgment:** Answer structured epistemic probes (`noul`, `choice`, `score`), point directly to offending token spans (`locus`), and score context salience for cache-safe compaction (`salience`) in a single forward pass with zero autoregressive token generation. --- ## 1. Backbone Arena & Weight Surgery Before training anything, I benchmarked four sub-1B architectures 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 logit parity). That leaves a `3:1` hybrid stack: **`18` Gated DeltaNet linear-recurrent layers** (`18.6 MiB` constant recurrent + conv state regardless of sequence length) interleaved with only **`6` GQA full-attention layers** (`256K` native context): | Candidate Backbone | Params | Architecture Split | 128K BF16 State (A100) | Apple M5 Metal @ 64K | Apple M5 Metal @ 128K | 64K / 128K Trajectory Needle Gate | |---|---:|---|---:|---:|---:|---| | **`Warden-S1-752M` (`Qwen3.5` text-only, Q4)** | **752M** | **18 Gated DeltaNet + 6 GQA** | **1,555 MiB** | **831.1 MiB** *(Q8 KV)* | **855.3 MiB** *(Q4 KV)* | **PASS** (exact 128K secret match) | | `Qwen/Qwen3-0.6B` (YaRN) | 599M | 28 Full GQA | 14,336 MiB | 2,606 MiB *(Q4 KV)* | 4,414 MiB *(Q4 KV)* | FAIL (`> 1 GiB` cap by `2.5x-14x`) | | `tiiuae/Falcon-H1-0.5B` | 522M | 36 Parallel Mamba-2 + GQA | 2,278 MiB | 945 MiB *(Q8 KV)* | 981 MiB *(Q4 KV)* | FAIL (`0/4` recall @ 64K/128K; `688.7s` prefill) | | `LiquidAI/LFM2-700M` | 743M | 10 Short-Conv + 6 GQA | 1,536 MiB | 854 MiB *(Q8 KV)* | 878 MiB *(Q4 KV)* | FAIL (negative log-prob margin @ 64K/128K) | ![Warden-S1 Memory Scaling to 128K Tokens on A100 and Apple M5 Metal](/imgs/warden-s1-memory-128k.png) --- ## 2. `O(ΔL)` Turn-Delta Speedup & Multi-Head Probing Because a coding agent appends one turn (`~1K-2K` tokens) onto an existing session prefix, `Warden-S1` caches the `18.6 MiB` Gated DeltaNet recurrent state alongside the 6-layer GQA KV cache: - **`18.76x` warm turn speedup on Apple M5 Metal:** `1.59 s` warm (`60K` cached + `2K` turn delta) vs `30.4 s` cold `62K` prefill. - **`18.92x` warm turn speedup on NVIDIA A100:** `157.6 ms` warm vs `2,981 ms` cold `62K` prefill. - **Batched zero-decode epistemic probing (`K = 32` questions in parallel):** Evaluates 32 independent verification/policy probes against a frozen `64K` trajectory in **`15.32 ms/question`** (`5.41x` batch speedup) with **`0.0` cross-question state mutation**. ![Sandwiched O(Delta L) Turn-Delta Latency Across Candidate Backbones](/imgs/warden-s1-delta-latency.png) --- ## 3. `WardenS1-Bench`, Stage 3.5 Curriculum & Cross-Platform `ONNX-Int4` To train and evaluate the five heads (`noul`, `choice`, `score`, `locus`, and `salience`) on realistic long-horizon trajectories, I built `WardenS1-Bench` (`4,200` trajectories, `225,650,644` exact tokens, `47.14%` spanning `50K-128K` tokens, `67,200` structured probes across six operational failure classes, and `2,100` counterfactual twin pairs with Union-Find fork 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 / pre-stop / oscillation 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 Macro-F1 | Score Spearman ρ | CF Net Sensitivity | 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 `<1 GiB`)** | **`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`** | | `Warden-S1-752M` (No Counterfactual 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` | ![Length-Bucket Robustness Across 4K to 128K Coding Trajectories](/imgs/warden-s1-robustness-128k.png) ![Six-Domain Composite System-One Radar on WardenS1-Bench](/imgs/warden-s1-bench-radar.png) ![Calibration Reliability Curve and Epistemic Abstention](/imgs/warden-s1-calibration.png) On Apple M5 Metal, Stage 3.5 `Warden-S1-752M-MLX-Q4` (`415.50 MiB` on disk, `415.41 MiB` active weights+heads) holds steady active 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 parity (`0.00271` overall mean probability delta, `0.0183` Noul delta, `0.9844` Locus Top-1 agreement). For Linux, Windows, Node/CI, and browser WebGPU/WASM execution, the **`461.3 MiB` sharded `ONNX-Int4` package** (`0` PyTorch runtime, `6` shards all `<= 92 MiB`, `150` `MatMulNBits` 4-bit projections, `0` control-flow ops) preserves **`0.9923` Noul AUROC**, **`0.0123` overall mean probability delta vs. BF16**, and deterministic `O(ΔL)` state equivalence (`max |Δprob| = 6.85e-7` in `onnxruntime-node`). --- ## 4. 10-Session `< 1 GiB` Multiplexing & Live `100K+` Agent Runs To verify daily multi-project operation, I drove Stage 3.5 `Warden-S1-752M-MLX-Q4` behind a local TypeSafe-compatible loopback daemon across two live workloads: 1. **10 simultaneous `64K-98K` coding sessions (`6 x 64K` Q8 KV + `2 x 80K` Q4 KV + `2 x 98K` Q4 KV):** Peak Apple M5 Metal active residency stayed at **`858.33 MiB`** (`165.67 MiB` headroom below `1,024 MiB`), achieving **`20/20` (`100%`)** concurrent delta cache hits, **`22/22`** 2-token BPE boundary-healed prefix matches across greedy newline merges, and **`3.13x` zstd L3 cold-wake compression** (`341.69 MiB -> 109.01 MiB` at `98K` tokens, `2/2` cold-wake delta hits). 2. **Fast L2 RAM Paging (`2,344 ms -> 104.4 ms`, `22.5x` faster) & 2-Token BPE Boundary Healing:** Replacing naive Python/numpy state copies with pinned host RAM paging cut L2 swap p50 from `2,344 ms` to **`104.39 ms`** (`22.5x` faster, with contiguous host-RAM slabs targeting `<50 ms`), while checkpointing recurrent + KV state `2` tokens before each turn boundary (`len(ids) - 2`) eliminated exact-prefix invalidation whenever a new turn's leading `\n` merged into `\n\n`. 3. **Persistent `100K+`-token RPC trajectory verification (`Haiku 5.5`, `Sonnet 5.5`, `Opus 5.5`):** Sustained **`96.3%-97.0%` prompt KV cache-read hit rates** through `104.5K-130.8K` context depth (`0` protocol errors at `$0.00` GPU cost, blocking an unhinted `R3:never-clip-user-text` escape introduced by the unguarded Haiku control arm). ![Warden-S1 Live 100K Sessions and 10-Session Sub-1GiB Metal Multiplexing](/imgs/warden-s1-multiplex-100k.png) --- ## 5. 100-Request Stratified Head-to-Head vs. Cloud `Jev` & OOD `pi-warden` Benches I evaluated 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` length buckets, plus `28` short `<4K` `pi-warden` static `judge-bench` and `rules-bench` cases; rescored with `0` new Cloud `Jev` calls): | Metric | `Warden-S1-752M-MLX-Q4` (Matched `n=66`) | Cloud `Jev` `jev-latest` (Matched `n=66`) | `Warden-S1` All 100 Reqs | |---|---:|---:|---:| | Request Acceptance / Context 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 from `0.5` / Overconf. | **`0.0213` / `0.0%`** | `0.4664` / `100.0%` | **`0.0216` / `0.0%`** | | Counterfactual Target 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`** | ![Cloud Jev vs Local Warden-S1-752M-MLX-Q4 Head-to-Head](/imgs/warden-s1-jev-h2h.png) **Stage 3.5 out-of-distribution `pi-warden` static benchmark gains (`0` benchmark overlap, `$0.00` local loopback):** - **`<4K` head-to-head slice (`n=28`):** Noul AUROC rose from **`0.5231` -> `0.6872`** overall, reaching **`1.0000`** on `judge_bench_stuck` and **`0.7755`** on `rules_bench`. - **`judge-bench` (`80` cases, `240` requests):** `stuck` accuracy climbed 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`), and `done` recall jumped from `10%-35%` to **`75.0%-80.0%`**. - **`rules-bench` (`161` cases, `147` scored):** Recall@0.5 surged from `5.4%` to **`41.9%`** (**`7.75x`** 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. Stage 4 Open-Weight Release Pack The Stage 4 Apache-2.0 release pack is staged locally and audited for zero privacy leaks and programmatic metric parity: 1. **Weights & Runtimes:** `Warden-S1-752M` (`BF16`), `Warden-S1-752M-MLX-4bit` (`415.5 MiB` Apple Silicon), `Warden-S1-752M-ONNX-Int4` (`461.3 MiB` sharded Linux/Windows/Node/WebGPU), and the standalone `warden-s1` loopback daemon CLI (`pi-warden` / `pi-typesafe` drop-in). 2. **Dataset & Paper:** `WardenS1-Bench` (`4,200` trajectories, `225.7M` tokens, `67,200` probes, official evaluation harness) and the full technical paper (`warden-s1-paper.pdf`).