{"slug": "training-small-decision-models-for-the-sdlc", "title": "Training small decision models for the SDLC", "summary": "A project called spawl, trained by Justin Poehnelt, lifted long-contradiction accuracy on software-development decision tasks from about 70% with strictly causal Qwen3 models to 98%-100% by switching to bidirectional full-attention Qwen3.5 backbones, according to Poehnelt's write-up of 14 models scored across three benchmarks. Poehnelt reported that spawl-4b held 100% (30/30) accuracy through 63,279 tokens on a 4k-64k haystack test while adding only +0.29 GB of resident memory, and that packed 6-question rubrics ran in 53.8 ms at 512 tokens and 109.0 ms at 2,048 tokens on a Blackwell G4 GPU. Making all 36 layers of a dense Qwen3-8B bidirectional collapsed accuracy to 48.45%, while keeping 27 of 36 layers causal-anchored and making only 9 bidirectional rescued +17.0 points.", "body_md": "# Training small decision models for the SDLC\n\nBy [Justin Poehnelt](https://justin.poehnelt.com/about/)  Published    16 min read   \n\nMost AI checks in software engineering do not need a chatbot. When a CI pipeline checks whether a pull request skips a test, triages a review-bot comment, or decides whether a coding agent is stuck in a retry loop, you want a typed verdict, a calibrated probability, and the offending line span, not three paragraphs of prose.\n\nTypeSafe AI popularized this pattern with Jev (`/v1/systemone`), charging $0.042 per million input tokens with $0 output tokens across three typed primitives: `noul` (boolean probability), `choice` (categorical selection), and `score` (ordered rubric). Open-weight peers like Cloudflare’s `Clef`, `Torchcast Decision`, `H2O-Lightning`, and Perplexity’s `pplx-decider` followed with Apache-2.0 decision models ranging from `4B` to `31B`.\n\nI wanted to see if a small open-weight model specialized for the SDLC could sit on the Pareto frontier against both `4B-31B` generalist decision models and fast cloud LLMs without breaking general-domain performance. I called the project **spawl** (chipping away at decisions in the SDLC). Here is how the architecture works, what failed, and how all 14 models scored across three benchmarks.\n\n## Why causal attention stalls on diffs\n\nMy first runs fine-tuned strictly causal `Qwen3` models with packed multi-question FlexAttention trees. They were fast, but they hit a ceiling on long-context contradictions. When a pull request description claims “read-only refactor” at token 40 and a diff hunk mutates state at token 950, every strictly causal 4B model I tested stalled near `70%` accuracy.\n\nSwitching to bidirectional full-attention `Qwen3.5` backbones (starting from Apache-2.0 decision peers like `torchcast-ai/torchcast-decision-4b` and `h2oai/h2o-lightning-4b`) lifted long-contradiction accuracy from `70%` to `98%-100%`.\n\n`Qwen3.5` uses a `3:1` hybrid layout: linear-attention GatedDeltaNet layers interleaved with full-attention layers (`24` linear + `8` full on `4B`; `18` linear + `6` full on `0.8B`), a `262,144`-token native context window, and an identical `248,320`-token vocabulary across sizes. That shared layout gave me one serving design for both cloud and edge models:\n\n- **Single question (`Q == 1`):** Run non-causal full attention over`[document + question]` with`attention_mask=None` for`O(T)` Flash SDPA memory. On a`4k-64k` haystack test,`spawl-4b` held`100%` (`30/30` ) accuracy through`63,279` tokens while adding only`+0.29 GB` of resident memory from`4k` to`64k` .\n- **Packed rubric (`Q >= 2`):** Encode the document once into a` Stage2Cache` (caching the full-attention KV tensors plus the DeltaNet conv and recurrent states), then score all`Q` question suffixes in one batched pass. On a Blackwell G4 GPU this runs 6-question packs in`53.8 ms` at 512 tokens and`109.0 ms` at 2,048 tokens (`2.3x` to`4.9x` faster than 6-row batching) with`0.00000000` cross-question order drift.\n\nI also tested why `Qwen3.5`’s `3:1` ratio matters. Turning `100%` (`36/36`) of layers bidirectional on a dense `Qwen3-8B` collapsed representations completely (`48.45%` accuracy, `4.0%` pair consistency). Keeping `75%` (`27/36`) causal-anchored and making only `25%` (`9/36`) periodic layers bidirectional rescued `+17.0 pt`. Causal anchoring keeps LoRA representations stable while periodic bidirectional layers handle cross-file comparison.\n\n## Four real bugs that only surfaced against git history\n\nEvery time I replaced clean synthetic checks with real git commits, long traces, or external rubrics, a concrete bug showed up:\n\n1. **Long-context forgetting in DeltaNet decay gates.** Tuning`in_proj_a` and`in_proj_b` on`< 1k` -token examples shortened recurrent memory and dropped accuracy from`96%` at 2k tokens to`52%` at 16k tokens. Anchoring`in_proj_a` and`in_proj_b` back to base weights with L2 regularization at`0.1x` LR while mixing`2k-16k` agent traces fixed extrapolation through 64k tokens. On real`36k-52k` traces,`spawl-4b` scored`85.0%` where live`jev-1.14.0` returned`HTTP 400 max_tokens_exceeded` on`20/20` items.\n2. **A `-2.5` polarity framing skew.** After adding my epistemic uncertainty head (`needs_context_prob` ) and zero-latency 1-pass line pointer (`0.33 ms` , line-pooling`doc_hidden` once during prefill), an early checkpoint predicted`False` on`242` of`250` counterfactual items. Pair ranking was still intact (`93/125` ). The training set had phrased`gold = \"true\"` as “clean/fixed” while eval phrased`gold = \"true\"` as “buggy/reverted”. Balancing both polarities 50/50 and adding a paired-twin margin loss fixed it.\n3. **A file-count shortcut in missing-context detection.** My first context-ablation set had two files on`75/75` complete items and one file on`75/75` ablated items.`spawl-0.8b` memorized file count (`1.000` in-domain AUROC,`0.5375` out-of-distribution). Rebuilding missing-context data into a 4-quadrant design (1-file complete, 2-file complete, 1-file missing, and 2-file with a decoy sibling file) forced file count and length to`0.50` AUROC and lifted`0.8B` out-of-distribution`needs_context` AUROC to`0.8922` (`0.9681` on`4B` ).\n4. **Ordinal scale mismatch on `score` rubrics.** My first ordinal dataset used 5-level`1..5` scales with soft`kl_temp = 1.2` , which dropped external`JevBench score` accuracy to`40.0%` by smearing level`0` predictions into level`1` . In practice,`98.3%` (`229/233` ) of external`score` rubrics use a 0-indexed 4-level`0..3` scale (`0 = none` ). Training on`2,400` 0-indexed`0..3` items with sharp`0` -boundary targets (`mean_p0 = 0.928` ,`kl_temp = 1.0` ) fixed the collapse.\n\n## Architecture experiments that failed\n\nBefore scaling data, I ran controlled ablations on 95GB Blackwell G4 GPUs against a locked repo-disjoint `val_600` harness. Three appealing ideas failed cleanly:\n\n- **Custom multi-module serving stacks.** I built a 4-module prototype stack (`+21.19M` params) and ran a frozen-recipe A/B against Pure 1-Pass on identical Blackwell G4s. Across`4,215` pooled items, they tied (`78.88%` vs`78.91%` , W/L`102/103` ,`p = 1.0000` ) while adding`+15.6%` latency and hurting prompt-injection defense (`8.6%` vs`2.9%` ). I deleted all four modules and kept Pure 1-Pass.\n- **Targeted Latent Adversarial Training.** Adding 1-step PGD latent perturbations (`eps = 0.15` ) to middle full-attention layers`[L11, L15, L23]` on prompt-injection batches dropped`val_score` by`-1.67 pt` . Depth telemetry showed the readout head actively routed around those perturbed middle layers (`< 0.9%` combined attention) onto shallow`L3` and`L7` , confirming that middle layers carry semantic reasoning.\n- **Muon optimizer on warm-started LoRA.** Five-step Newton-Schulz Muon (`lr = 0.005` ) blew up skinny`32x2560` LoRA adapters immediately (`loss = 4.52` at step 25 vs`1.43` under AdamW`2e-5` ) due to`~9x` aspect-ratio scaling.\n\n## What worked: Zero-Init Readout-DCA, 69k real OSS commits, and WiSE-FT\n\nThree changes drove the final gains without adding serving latency.\n\n### 1. Zero-Init Readout-DCA (`0 ms` latency tax, stock backbone)\n\nInspired by Google Research’s [DeepCrossAttention](https://research.google/blog/supercharging-transformer-residual-connections/) (`arXiv:2502.06785`), I added a small depth-wise cross-attention module (` DepthCrossAttnReadout`) strictly inside the sidecar readout heads (` 3.30M` params on `4B` = `0.078%` overhead; `531K` params on `0.8B`). Forward hooks capture only the full-attention layer outputs (`[3, 7, 11, 15, 19, 23, 27, 31]` on `4B`; `[3, 7, 11, 15, 19, 23]` on `0.8B`), apply per-tap RMSNorm, and compute 4-head input-dependent depth routing before adding `W_o(ctx)` to the final hidden state.\n\nInitializing `W_o = 0` and depth bias `b_depth = [-6, ..., -6, 0]` (`99.7%` weight on the final layer) guarantees exact `0.0000` step-0 parity and leaves the `Qwen3.5` backbone 100% stock for Hugging Face and Apple Silicon MLX serving.\n\nIn a single-variable 35-minute A/B test on `val_600`, Zero-Init Readout-DCA won on every metric with zero latency cost:\n\n| Metric ( `val_600` , 35m Blackwell G4) | Pure 1-Pass Baseline | + Zero-Init Readout-DCA | Delta | \n|---|---|---|---|\n| `val_score` | `0.8135` | **`0.8206`** | `+0.71 pt` | \n| Accuracy / Pair-both | `78.28%` /`67.60%` | **`78.97%` / `68.40%`** | `+0.69` /`+0.80 pt` | \n| Calibration error ( `ECE` ) | `0.0424` | **`0.0321`** | `-24%` error | \n| Evidence `Ev@3` | `95.52%` | **`95.86%`** | `+0.34 pt` | \n| `L512` p50 latency (G4) | `32.51 ms` | **`31.84 ms`** | `-0.67 ms` (`0` tax) | \n\nDespite the `-6.0` initial penalty against early layers, `q * k` pulled `50.1%` of decision-token attention off `L31` in 35 minutes: Head 0 specialized into mid-layer semantics (`90.0% L15 + 10.0% L11`), Head 2 specialized into early syntax (` 66.8% L7 + 31.3% L3`), and Heads 1 and 3 stayed anchored on `L31`. On full-epoch runs, decision tokens pulled `75%-100%` of depth attention off the final layer.\n\n### 2. Mining 69,368 real execution-verified OSS commits (`$0` API)\n\nSynthetic LLM counterfactual pairs hit diminishing returns near `80.6%` pooled accuracy. To break past that wall, I built zero-API git, OSV, and GitHub Actions miners across **`1,641` eval-disjoint permissive repositories in 11 languages**, harvesting **`69,368` real execution-verified items** (`34,684` intact pairs, `0.49-0.52` GroupKFold TF-IDF, `0.500` length AUROC, `100%` grounded line pointers):\n\n- `30,808` real bug-fix commits (`18,726` prod-code snapshots +`12,082` prod + regression-test pairs) and`2,202` real git reverts.\n- `8,840` multi-file API and interface fixes,`7,372` SQL/DB migrations,`2,188` performance/memory-leak fixes, and`1,774` real auth/permission fixes.\n- `8,746` real OSV/GHSA pre-patch vs post-patch security commits mined from`293,965` public advisories (strictly excluding every CVE and repo in eval),`5,968` dependency-breaking migrations, and`1,470` real red-to-green GitHub Actions commits.\n\nCombined with earlier SDLC and Stackelberg prompt-injection data, the final audited training bundle holds **`141,451` items**.\n\n### 3. Weight-space averaging (`WiSE-FT 50/50`)\n\nAdding `69,368` real-OSS items lifted git/agent checks to `71.61%` and completed a 7/7 SDLC lifecycle sweep (`81.65%`), but slightly diluted legacy long-context replay (`-1.03 pt`). Training a replay-balanced sibling run recovered legacy replay (`89.46%`) and drove coding-artifact prompt-injection bypass to `0.0%` (`0/35`). Linearly averaging both checkpoints in weight space (` 50/50` LoRA + Readout-DCA heads on the same anchor, zero cross-term error) kept the best of both runs: **`80.83%` pooled**, **`71.61%` git/agent**, **`0.0%` coding PI bypass**, `89.22%` long-context, and `74.66%` on `withmartian/code-review-benchmark`.\n\n## Benchmark 1: `SWE-Decide` across 14 decision models and LLMs\n\n`SWE-Decide` spans `4,215` decidable items (`4,380` total, strictly repo- and CVE-disjoint from training) across three slices:\n\n- **7-stage SDLC lifecycle gates (`1,030` items):** 33 engineering gates covering intake, context/memory, agent harnesses, code review, security/API, CI/dependencies, and release/ops.\n- **Zero-LLM-judge git and agent checks (`1,525` items):** Real bug-fix counterfactuals, reverted PRs, actionable inline review threads,`16k-48k` cross-file diffs, 4-quadrant context ablations, pre-tool safety, stop-hook tampering, and adversarial coding-artifact prompt injection.\n- **Long-context and legacy regression suite (`1,660` items):** Contradictions, review-bot threads,`2k-64k` coding-agent traces, and CI failure logs.\n\nEvery open-weight decision model ran its official Hugging Face inference code and bidirectional attention mask on a Blackwell G4 GPU. Every cloud LLM ran with strict JSON output and calibrated probabilities; non-thinking models ran with thinking disabled (`0` reasoning tokens), while `google/gemini-4-hydrogen` enforces mandatory reasoning (`1.17M` reasoning tokens across the suite). Context overflows and blocked calls score `0` on the same `4,215` denominator.\n\n### Full `SWE-Decide` scoreboard (`4,215` decidable items)\n\n| Rank | Model | Type | Pooled `4,215` | SDLC 7-Stage ( `1,030` ) | `ECE` | Git & Agent ( `1,525` ) | Long & Legacy ( `1,660` ) | PI Bypass | Latency p50 | Cost / 1M in | vs `spawl-4b` (`p` ) | \n|---|---|---|---|---|---|---|---|---|---|---|---|\n| 1 | `google/gemini-4-hydrogen` | Thinking LLM ( `1.17M` r-tok) | **`83.53%`** | **` 83.59%`** | `0.104` | **`74.23%`** | **` 92.05%`** | `14.3%` | `2,925 ms` | `$2.08` | `+2.70 pt` (`2.93e-5` ) | \n| **2** | **`spawl-4b`** (` WiSE 50/50` ) | **4B Decision** | **`80.83%`** | `80.97%` | **`0.027`** | **` 71.61%`** | `89.22%` | **`0.0%`** | **` 31.8 ms`** | self-host ( `~$0.03` ) | baseline | \n| 3 | `Cloudflare/clef` | 27B Decision | `79.98%` | `80.19%` | `0.065` | `69.64%` | `89.34%` | `54.3%` | `168.6 ms` | self-host ( `~$0.16` ) | `-0.85 pt` (`0.212` ) | \n| 4 | `torchcast-decision-31b` | 31B Decision ( `139` ovf) | `79.41%` | `80.10%` | `0.142` | `66.75%` | `90.60%` | `28.6%` | `177.1 ms` | self-host ( `~$0.18` ) | `-1.42 pt` (`0.021` ) | \n| 5 | `anthropic/claude-sonnet-5.5` | Non-Think LLM | `79.10%` | `81.07%` | `0.030` | `67.02%` | `88.98%` | `20.0%` | `1,458 ms` | `$2.27` | `-1.73 pt` (`0.015` ) | \n| 6 | `anthropic/claude-haiku-5.5` | Non-Think LLM | `78.34%` | `78.35%` | `0.062` | `69.44%` | `86.51%` | `5.7%` | `699 ms` | `$0.11` | `-2.49 pt` (`3.09e-4` ) | \n| 7 | `torchcast-decision-4b` | 4B Decision | `77.79%` | `77.28%` | `0.121` | `67.15%` | `87.89%` | `28.6%` | `54.6 ms` | self-host ( `~$0.045` ) | `-3.04 pt` (`2.33e-8` ) | \n| 8 | `openai/gpt-6-luna` | Non-Think LLM | `77.51%` | `75.44%` | `0.204` | `71.08%` | `84.70%` | `82.9%` | `896 ms` | `$0.13` | `-3.32 pt` (`1.93e-6` ) | \n| 9 | `jev-1.14.0` | Decision API ( `119` ovf) | `77.46%` | `79.13%` | `0.029` | `63.28%` | `89.46%` | `88.6%` | `81.1 ms` | `$0.042` | `-3.37 pt` (`1.25e-7` ) | \n| 10 | `h2o-lightning-4b` | 4B Decision | `77.18%` | `76.80%` | `0.061` | `66.23%` | `87.47%` | `34.3%` | `48.6 ms` | self-host ( `~$0.04` ) | `-3.65 pt` (`2.33e-9` ) | \n| 11 | `pplx-decider-flash-v1.3` | 4B Decision ( `124` ovf) | `76.63%` | `77.48%` | `0.111` | `63.93%` | `87.77%` | `11.4%` | `311.9 ms` | self-host ( `~$0.055` ) | `-4.20 pt` (`4.37e-13` ) | \n| 12 | `Cloudflare/clef-flash` | 9B Decision | `75.35%` | `76.02%` | `0.069` | `63.41%` | `85.90%` | `65.7%` | `60.9 ms` | self-host ( `~$0.07` ) | `-5.48 pt` (`2.12e-16` ) | \n| 13 | `Intern-Decision-4B` | 4B Decision ( `124` ovf) | `73.57%` | `71.84%` | `0.097` | `61.31%` | `85.90%` | `40.0%` | `326.5 ms` | self-host ( `~$0.055` ) | `-7.26 pt` (`6.71e-28` ) | \n| **14** | **`spawl-0.8b`** (` WiSE` MLX) | **0.8B Decision** | **`70.53%`** | `69.71%` | `0.092` | `62.36%` | `78.55%` | `5.7%` | **`16.2 ms`** | offline | `-10.30 pt` (`4.42e-43` ) | \n\n## Benchmark 2 and 3: Zero-contamination third-party suites\n\nBecause I authored `SWE-Decide`, the obvious question is whether `spawl-4b` simply overfit its own distribution. I ran two completely independent third-party suites after verifying **`0` overlaps across all `141,451` training items** (exact hashes, commit SHAs, and 100-120 char prefixes):\n\n1. **Full Official `JevBench` (`JevBench/jevbench`):** All` 240` cases /`2,240` questions (`1,938` known gold across 12 non-SDLC operational domains) plus the`1,200` -test`jevbench-mini` metamorphic coherence suite (`REP` rephrase,`BAT` batch invariance,`MEA` meaningfulness,`LOG` logical consistency,`CHO` choice-set IIA), verified bit-exact (`0.0000` diff) against`JevBench/data/leaderboard.jsonl` .\n2. **Official `PrimeVul` Paired (`ASSERT-KTH/PrimeVul` `test_paired`):**` 564` real pre-patch vs post-patch C/C++ CVE function pairs (`1,128` functions across`200` OSS projects, zero CVE/project metadata exposed). Note: we caught and independently verified that the`ASSERT-KTH/PrimeVul` Hugging Face mirror inverted its`is_vulnerable` column relative to the paper’s`target` label (proven by`test_unpaired` class ratios`25,216/695` , patched-function length asymmetry`482/564` , and manual inspection of real CVE diffs), so all 11 models are scored on verified ground truth.\n\n### Official `JevBench` (`1,938` non-SDLC gold + `1,200` metamorphic tests)\n\n| Model | Params | Acc ( `1,938` ) | Brier | LogLoss | ECE-10 | Overall (mini) | `REP / BAT / MEA / LOG / CHO` | vs `spawl-4b` | \n|---|---|---|---|---|---|---|---|---|\n| `torchcast-decision-4b` | 4B | **`91.43%`** | **` 0.1159`** | `0.2449` | `0.0437` | **`83.70%`** | `87.8 / 100.0 / 61.3 / 95.8 / 73.6` | `p = 0.374` (tie) | \n| **`spawl-4b`** | **4B** | **` 91.02%`** | `0.1305` | `0.2966` | `0.0959` | `76.03%` | `79.2 / 100.0 / 51.0 / 91.7 / 58.3` | baseline | \n| `Cloudflare/clef` | 27B | `90.51%` | `0.1237` | **`0.2424`** | `0.0333` | `75.41%` | `82.2 / 65.8 / 64.0 / 90.0 / 75.0` | `p = 0.407` (tie) | \n| `jev-1.14.0` | API | `90.40%` | `0.1341` | `0.5146` | **`0.0319`** | `83.29%` | `83.9 / 94.2 / 64.0 / 96.7 / 77.8` | `p = 0.261` | \n| `h2o-lightning-4b` | 4B | `89.53%` | `0.1484` | `0.3144` | `0.0799` | `80.38%` | `88.6 / 100.0 / 50.5 / 93.3 / 69.4` | `p = 0.0065` | \n| `Cloudflare/clef-flash` | 9B | `87.93%` | `0.1545` | `0.2989` | `0.0478` | `76.25%` | `83.6 / 75.8 / 55.4 / 90.0 / 76.4` | `p < 1e-6` | \n| **`spawl-0.8b`** | **0.8B** | `80.03%` | `0.2762` | `0.5014` | `0.0361` | `64.30%` | `73.3 / 100.0 / 32.4 / 61.7 / 54.2` | `p < 1e-6` | \n\nSpecializing on SDLC data did not lobotomize general-domain performance: `spawl-4b` (`91.02%`, Brier `0.1305`) beats all `25` published official `JevBench` leaderboard baselines (highest published: `OneJev-4B` `89.22%`, `Open-Jev-9B` `88.44%`), statistically ties `torchcast-4b`, and edges `27B` `Cloudflare/clef` on both accuracy and metamorphic overall. Metamorphic testing also surfaced a clear architectural difference: both `Cloudflare/clef` models leak cross-question state when questions are batched (`BAT = 65.8%` on `27B`, `75.8%` on `9B`), while `spawl`’s prefix-cached design holds `BAT = 100.0%`.\n\n### Official `PrimeVul` Paired (`564` real C/C++ CVE pairs)\n\n| Model | Ovf | Soft Pair-Rank | Strict Pair-Rank | `P-C` (Both Right) | Acc | AUROC | ECE | Brier | vs `spawl-4b` (`P-C p` ) | \n|---|---|---|---|---|---|---|---|---|---|\n| `torchcast-decision-31b` (`31B` ) | `6` | **`61.26%`** | `40.43%` | `10.46%` | **`54.26%`** | **` 0.5573`** | `0.3037` | `0.3414` | `p = 1.000` (tie) | \n| **`spawl-4b`** (` 4B` ) | **`0`** | **` 61.17%`** | **` 61.17%`** | `10.28%` | `53.28%` | `0.5523` | **`0.0355`** | **` 0.2492`** | baseline | \n| `jev-1.14.0` (API) | `0` | `56.12%` | `47.16%` | `3.01%` | `50.53%` | `0.5202` | `0.1783` | `0.2882` | `p < 1e-6` | \n| `claude-haiku-5.5` | `0` | `55.59%` | `34.22%` | `8.69%` | `52.22%` | `0.5344` | `0.2569` | `0.3214` | `p = 0.407` | \n| `gemini-4-hydrogen` | `0` | `54.43%` | `15.25%` | `5.32%` | `51.06%` | `0.5409` | `0.0552` | `0.2587` | `p = 0.0023` | \n| `Cloudflare/clef` (`27B` ) | `0` | `53.37%` | `52.84%` | `4.43%` | `51.33%` | `0.5208` | `0.3254` | `0.3655` | `p = 7e-5` | \n| `gpt-6-luna` | `0` | `53.37%` | `37.94%` | **`11.17%`** | `53.63%` | `0.5395` | `0.3952` | `0.4101` | `p = 0.691` | \n| `h2o-lightning-4b` (`4B` ) | `0` | `52.39%` | `52.30%` | `1.60%` | `50.44%` | `0.5069` | `0.2001` | `0.3009` | `p < 1e-6` | \n| `torchcast-decision-4b` (`4B` ) | `0` | `51.60%` | `9.93%` | `4.43%` | `51.15%` | `0.5137` | `0.2921` | `0.3352` | `p = 1e-5` | \n| `Cloudflare/clef-flash` (`9B` ) | `0` | `50.98%` | `49.29%` | `1.24%` | `50.35%` | `0.4963` | `0.3159` | `0.3662` | `p < 1e-6` | \n| `spawl-0.8b` (`0.8B` ) | `0` | `50.89%` | `50.89%` | `1.95%` | `49.11%` | `0.4957` | `0.1034` | `0.2639` | `p < 1e-6` | \n\nOne forensic finding stood out while verifying `torchcast-decision-4b` and `31b`: their bundled `TorchcastDecision` inference code hardcodes a `noul_floor = 0.801` clamp that snaps any uncertain probability in `(0.199, 0.801)` to `0.199` or `0.801`. On hard security functions, that creates `42%-83%` probability ties and drives `ECE` above `0.29`. Without that clamp, `spawl-4b` ties `7.75x`-larger `torchcast-31b` on Soft Pair-Rank (`61.17%` vs `61.26%`), beats `27B` `Cloudflare/clef` by `+7.8 pt` (`P-C p = 7e-5`), and is the only model out of 11 with a Brier score below `0.250` (`0.2492`).\n\n## Where the results hold up and where they don’t\n\nIt is easy to overclaim from a big table. Here is what I think is genuinely meaningful and what is not:\n\n- **Domain-alignment advantage on `SWE-Decide`:** Even with strict repo-/CVE-disjoint splits and zero-LLM-judge git labels,`spawl` was trained on SDLC task distributions while`Clef` ,`Torchcast` ,`H2O` , and`Sonnet` ran zero-shot. The honest conclusion is that domain post-training plus`69k` real OSS commits lets a`4B` model (`31.8 ms` ) beat`4B-9B` peers and non-thinking`Sonnet` /`Haiku` /`Luna` on SDLC work, not that`4B` is generally smarter than`27B` or`Sonnet` .\n- **`spawl-4b` vs `27B` `Cloudflare/clef` accuracy is not statistically significant (`p = 0.21`):** The real edge over` 27B``Clef` is matching it at`6.75x` fewer parameters,`5.3x` lower latency,`0.0%` vs`54.3%` coding PI bypass, and`100%` vs`65.8%` batch invariance.\n- **No model solves isolated-function CVE detection:**`53.3%` raw accuracy and`0.552` AUROC on`PrimeVul` show that neither a`4B` model, a`31B` model, nor thinking`gemini-4-hydrogen` (`51.1%` acc,`P-C 5.3%` ) can replace a repo-aware security scanner from a single function snippet alone.\n- **Thinking System-2 still wins on raw accuracy:**`gemini-4-hydrogen` leads`spawl-4b` by`+2.70 pt` (`83.53%` vs`80.83%` ,`p = 2.93e-5` ) by spending`1.17M` reasoning tokens (`2.9 s` ,`$2.08/1M` ). A`4B` single-pass model caps near`~81%` ; the right production architecture is a fast System-1 filter escalating uncertain cases to System-2.\n- **Two real `spawl-4b` gaps to fix next:** On`JevBench` metamorphic tests,`spawl-4b` trails`torchcast-4b` and`jev-1.14.0` on choice-set IIA (`CHO 58.3%` ) and meaningfulness (`MEA 51.0%` ), and its non-SDLC`ECE` (`0.096` ) is underconfident (`Conf - Acc = -0.063` ). On unseen adaptive white-box prompt injection, attack success rate is still`53.3%` (`40.0%` on an earlier security-heavy checkpoint).\n\n## Offline Apple Silicon MLX (`spawl-0.8b`)\n\nStripping `453.7M` unused vision parameters from `Qwen/Qwen3.5-0.8B` leaves `752.4M` text parameters (`0` visual or MTP keys). Quantizing to 4-bit MLX (`q4`, group size 64) with patched bidirectional full-attention layers `[3, 7, 11, 15, 19, 23]` and the `531K`-param 6-tap Readout-DCA head fits in **` 404.4 MB` + `4.65 MB` heads** and runs completely offline on Apple Silicon:\n\n| Quantization | Size ( `weights + heads` ) | `512` tok (`Q1` p50 /`6Q` amortized) | `2,048` tok (`6Q` amortized) | `4,096` tok (`6Q` amortized) | Peak Metal RAM ( `512` tok) | \n|---|---|---|---|---|---|\n| **`mlx_q4`** | **` 404.4 + 4.65 MB`** | `16.22 ms` /**`4.47 ms/Q`** | **` 10.22 ms/Q`** | **` 20.38 ms/Q`** | `1.26 GB` | \n| **`mlx_q8`** | **` 762.9 + 4.65 MB`** | `20.81 ms` /**`4.58 ms/Q`** | **` 10.17 ms/Q`** | **` 20.39 ms/Q`** | `1.61 GB` | \n\nDistilling merged `35B-A3B + 4B` logits with Readout-DCA lifted `spawl-0.8b` to **`70.53%` pooled on `SWE-Decide`**, **` 80.03%` on Official `JevBench`** (` ECE 0.036`, `BAT 100.0%`), **` 56.11%` on hard git counterfactuals** (`+2.27 pt` above cloud `jev-1.14.0`), `75.24%` `Ev@3` line grounding, and **`5.7%` coding PI bypass**, with `+0.04 ms/Q` Readout-DCA overhead and `0.0` cross-question order drift.\n\n## Scaling reality check: `35B-A3B` MoE and System-2 cascades\n\nTo test whether a `3B`-active sparse MoE or local test-time reasoning could add another `+5%`, I ran two experiments on 95GB Blackwell G4s:\n\n1. **`Qwen/Qwen3.5-35B-A3B` (`35B` total / `3B` active, `10`-tap Readout-DCA).** Naive FP8 expert dequantization saved`~60 GiB` of BF16 weights in autograd and looped across active experts in Python (`631.8 ms` , OOMing`95 GiB` ). Writing a custom`_GroupedFP8LinearFunction` around PyTorch 2.14’s native Blackwell`torch._grouped_mm` (`80` launches instead of`~16,000` ,`0` saved BF16 expert tensors) dropped VRAM to`42.1 GiB` , pushed GPU utilization to`92%` , and sped up training`6.1x` per step. After`1,238` steps,`35B-A3B` beat`4B` on`JevBench score` (`55.00%` ), subtle single-file bug-fix counterfactuals (`71.2%` ), multi-tenant authz (`58.3%` ), and`Ev@3` (`98.5%` ), yet still ran`11x` slower than`4B` (`358 ms` vs`31.8 ms` ) and trailed converged`4B` overall (`77.82%` vs`80.83%` ). It works best as a`$0` -API teacher distilling`20,000` soft logits into`4B` and`0.8B` .\n2. **System-1-to-System-2 selective cascade (`20%` deferral).** Local`vLLM`` 35B-A3B` thinking (`2048t` ,`2,411 tok/s` agg) lifted generalist external sets (`88.67%` on our`300` -item`JevBench` slice,`76.01%` on`withmartian` ), while on specialized SDLC bugs domain-trained`31.8 ms`` spawl-4b` still beat zero-shot`11.25 s`` 35B-A3B` thinking. For a`+3-5 pt` leap on hard SDLC bugs, selective deferral needs a frontier System-2 model. Routing only`20%` of uncertain`spawl-4b` cases to System-2 sent`29.6%` of prompt tokens to System-2 (vs`69.5%` for`jev-1.14.0` , which overflows`8.5%` of long diffs), beating a`jev` cascade (`70.21%` vs`67.66%` ) at`44%` lower blended cost (`$1.34/1M` vs`$2.39/1M` ) and`63.2 ms` median latency (`160x` faster than System-2 alone).\n\n## Drop-in compatibility with Jev\n\n`spawl` exposes the same `POST /v1/systemone` endpoint supporting `noul`, `choice`, and Jev-native 0-indexed `score` criteria, with strictly additive fields (`needs_context`, `needs_context_prob`, and `evidence_spans`):\n\n``` js\nconst BASE_URL = \"https://api.spawl.dev\"; // was https://api.typesafe.ai\n\nconst res = await fetch(`${BASE_URL}/v1/systemone`, {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.SPAWL_API_KEY}`,\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    model: \"spawl-4b\",\n    state: prDiffAndAgentTrace,\n    questions: {\n      skipped_test: {\n        type: \"noul\",\n        instructions: \"Did the diff skip, delete, or weaken an existing test instead of fixing the bug?\",\n      },\n      merge_risk: {\n        type: \"score\",\n        instructions: \"Rate the production merge risk of this change.\",\n        criteria: [\"Trivial safe\", \"Low risk\", \"Moderate risk\", \"High blocking risk\"],\n      },\n      bot_verdict: {\n        type: \"choice\",\n        instructions: \"Classify the AI review bot thread on this hunk.\",\n        options: [\"real_bug\", \"resolved_fix\", \"nitpick_or_fp\", \"stale_comment\"],\n      },\n    },\n  }),\n});\n\nconst { answers, usage } = await res.json();\n// answers.skipped_test -> { choice, noul, probabilities, needs_context, needs_context_prob, evidence_spans }\n```\n\n`spawl-4b` and `spawl-0.8b` are built on Apache-2.0 `Qwen3.5` backbones and permissively licensed open-source repositories. The zero-LLM-judge git/agent evaluation set (`1,525` items) and the `69,368`-item real-OSS training corpus use zero proprietary LLM labels; the targeted synthetic counterfactual slices and ordinal rubrics used direct Claude API generation and blind verification.\n\n## Total spend\n\nAcross the full project (including `17` controlled ablations, all 14 models on `SWE-Decide`, `11` models on `PrimeVul` Paired, `7` models on full Official `JevBench`, `Qwen3.5-35B-A3B` MoE runs, and `vLLM` sweeps):\n\n- **OpenRouter (early experiments, frontier System-2 study, and full 4,215-item LLM leaderboard sweeps):**`~$234`\n- **Anthropic API (targeted synthetic counterfactuals, ordinal rubrics, and direct `claude-sonnet-5.5` benchmark completion):**`~$380` (`$0.00` spent on the`69,368` -item real-OSS corpus and`$0.00` on the zero-LLM-judge git/agent eval)\n- **Live Jev baseline calls (across `SWE-Decide`, `JevBench`, and `PrimeVul`):** under`$1.50`\n- **Colab GPU compute (L4, A100, and 95GB Blackwell G4):**`~1,200` compute units (`~$120` )\n\nNext up is fixing choice-set metamorphic invariance (`CHO`/` MEA`) and adaptive white-box prompt injection, then running an execution-verified `SWE-bench Verified` Best-of-N patch-reranking study.", "url": "https://wpnews.pro/news/training-small-decision-models-for-the-sdlc", "canonical_source": "https://justin.poehnelt.com/posts/training-a-small-decision-model-for-the-sdlc/", "published_at": "2026-11-29 00:00:00+00:00", "updated_at": "2026-11-30 22:14:22.797280+00:00", "lang": "en", "topics": ["machine-learning", "ai-research", "large-language-models", "ai-tools", "developer-tools"], "entities": ["Justin Poehnelt", "spawl", "Qwen3.5", "Qwen3", "TypeSafe AI", "Jev", "Cloudflare", "H2O-Lightning"], "also_reported_by": [], "takeaway": "Bidirectional full attention on Qwen3.5 lifted long-contradiction accuracy from about 70% to 98%-100%, while making all 36 layers of a dense Qwen3-8B bidirectional collapsed accuracy to 48.45% versus keeping 27 of 36 causal-anchored.", "recommendation": {"advice": "Keep most layers causal-anchored and make only periodic layers bidirectional when fine-tuning decision models; on dense Qwen3-8B, 27 of 36 causal layers plus 9 bidirectional rescued +17.0 points over full bidirectionality.", "playbook": "inference-serving", "playbook_url": "https://wpnews.pro/playbooks/inference-serving"}, "alternates": {"html": "https://wpnews.pro/news/training-small-decision-models-for-the-sdlc", "markdown": "https://wpnews.pro/news/training-small-decision-models-for-the-sdlc.md", "text": "https://wpnews.pro/news/training-small-decision-models-for-the-sdlc.txt", "jsonld": "https://wpnews.pro/news/training-small-decision-models-for-the-sdlc.jsonld"}}