eltokh7 commited on
Commit
dc33428
·
verified ·
1 Parent(s): 5048063

Finalize v5.1 release: STE100 README.md, Blackwell G4 engine benchmarks, 3 refreshed visuals, and updated modeling.py

Browse files
README.md CHANGED
@@ -10,39 +10,46 @@ tags:
10
  - early-exit
11
  - conformal-risk-control
12
  - selective-escalation
 
13
  - moe
14
  ---
15
 
16
- # Inkling-2-Mini Decision v5.0 (`eltokh7/inkling-2-mini-decision`)
17
 
18
  ![Should we have System 1.5 models?](assets/header.jpg)
19
 
20
  ## Overview
21
 
22
- `Inkling-2-Mini Decision v5.0` is an adaptive-depth decision model built on [thinkingmachines/Inkling-2-Mini](https://huggingface.co/thinkingmachines/Inkling-2-Mini) (26.4B total parameters, **3.4B–5.4B active MoE**).
23
 
24
  The model reads a state and one or more typed questions (`choice`, `noul` yes/no, or `score`) in one forward pass. It outputs calibrated probabilities and generates **zero output tokens**.
25
 
26
- The middle 12 layers run in a loop between **1 and 5 times** (24 to 72 logical layers). Simple questions stop after 1 pass. Hard multi-step questions loop deeper before the model answers. After Loop 5, a learned escalation head estimates whether to route the question to a slower System 2 model.
 
 
27
 
28
  ---
29
 
30
  ## Key Results
31
 
32
- `v5.0` (Super-Epoch 1) sets new highs on both everyday decisions (`decision-v7/test`) and held-out hard reasoning (`hard-v1/test`), with strictly monotonic accuracy from Loop 1 to Loop 5.
33
 
34
- | Benchmark | What it tests | v1 (3 loops) | v3 (5 loops) | v4 (5 loops) | **v5.0 (5 loops)** | Reference baselines |
35
- |---|---|---:|---:|---:|---:|---|
36
- | **`decision-v7/test`** ($n=1{,}440$) | Routine business, policy, and routing decisions | 85.56% | 86.67% | 86.94% | **87.15%** *(L5)* | `Kev-27B` (27B dense): 86.3% |
37
- | **`hard-v1/test`** ($n=1{,}088$, *OOD*) | Multi-hop, long policy, probability, tradeoff, numeric | 66.82% | 71.42% *(L3)* / 71.14% *(L5)* | 72.79% | **73.53%** *(L5)* | `Kev-9B v1` (9B dense): 58.4% |
38
- | **`hard-v1/dev`** ($n=1{,}083$, *OOD*) | Same hard OOD suite (dev split) | 66.67% | 69.16% *(L3)* / 67.13% *(L5)* | 68.33% | **69.44%** *(L5)* | `Kev-9B v1`: 58.2% · `Jev`: 78% |
 
 
 
 
39
 
40
- Four main takeaways:
41
 
42
- 1. **Higher accuracy than 27B-dense `Kev-27B` with ~5× fewer active parameters:** On `decision-v7/test`, `v5.0` reaches **87.15%** (`ECE = 0.0291`, `Brier = 0.2042`) and improves monotonically from Loop 1 (`83.68%`) to Loop 5 (`87.15%`).
43
- 2. **+22.24 pp latent reasoning gain on held-out `hard-v1/test`:** Accuracy climbs from `51.29%` (Loop 1) to **73.53%** (Loop 4 and Loop 5) with zero generated tokens.
44
- 3. **Adaptive halting cuts average depth to 2.13 loops on routine decisions:** Under Conformal `balanced` (`h >= 0.99`, `cal UCB95 = 0.41%`), **52.5%** of `decision-v7/test` questions exit after Loop 1 with **86.81%** accuracy and only **7 / 1,440 (`0.49%`)** fixable early-exit errors.
45
- 4. **Tri-state escalation lifts autonomous accuracy above 91%:** Routing the top 20% highest-risk questions to System 2 raises autonomous accuracy to **91.49%** on `decision-v7/test` (`AUROC = 0.7505`) and **80.11%** on `hard-v1/test` (`AUROC = 0.7437`).
46
 
47
  ![Comparison on untrained hard-v1](assets/hard_v1_comparison.png)
48
 
@@ -61,16 +68,16 @@ Input (state + question + options)
61
  • CrossLoopTrajectoryMixer attends across loops 1..k
62
  • FullContextEvidencePooler pools 100% of state tokens into <= 64 chunks
63
  • JointSchemaHead outputs calibrated option probabilities
64
- • EscalationHead predicts p_escalate for System 2 handoff
65
  ```
66
 
67
- ### What Is New in v5.0
68
 
69
- - **Loop-Conditioned Shared Reasoning Expert (`LoopedSharedExpert` + `AdaLN-Zero(k)`):** A 170M-parameter dense SwiGLU expert runs in parallel with the frozen MoE experts across layers `6–17`. Zero-initialized `AdaLN-Zero(k)` modulation (`scale_k`, `shift_k`, `gate_k`) gives each loop pass `k = 1..5` a distinct role.
70
- - **Full-Context Evidence Pooling (`FullContextEvidencePooler`):** Earlier versions sampled only 8 point tokens from the input document. `v5.0` pools **100% of state tokens** into up to 64 contiguous mean-pooled chunks with a residual projection before `JointSchemaHead` cross-attention.
71
- - **Cross-Loop Trajectory Readout (`CrossLoopTrajectoryMixer`):** Causal attention over loops `1..k` lets later passes synthesize earlier findings instead of overwriting them.
72
- - **Tri-State Cognitive Control (`Halt / Loop / Escalate`):** `DynamicHaltingHead` stops early on easy questions. When a question reaches Loop 5, `EscalationHead` predicts the probability that the Loop 5 answer is wrong (`escalate_prob`), enabling selective escalation to a System 2 model.
73
- - **Merged Standalone Weights + Tri-Teacher Distillation:** All unfrozen dynamic backbone tensors (`message_gate`, `moe_router`, `block_attn_res`, `message_input`, `final_norm`) and LoRA weights are merged into standalone BF16 safetensors. Super-Epoch 1 trained on 22,937 unique records combining multi-teacher soft-target KL distillation (`GLM-5.4` + `GPT-6.2-Sol` + `GPT-6.1-Terra`, 3,000 long documents, structural auxiliary probes) and clean Kev replay, with zero exposure to any eval split.
74
 
75
  ---
76
 
@@ -82,7 +89,7 @@ Install the requirements:
82
  pip install "transformers>=5.24.0" torch huggingface_hub
83
  ```
84
 
85
- Load `System15Engine` from `modeling.py` (`engine_v5.py`). It supports single queries, shared-state multi-question prefix caching, batched active-set compaction, and deadline-bounded anytime streaming:
86
 
87
  ```python
88
  from modeling import System15Engine
@@ -112,8 +119,8 @@ questions = {
112
  # 1. Shared-state multi-question execution (runs prelude layers 0..5 on `state` once)
113
  out = engine.decide_multi(state, questions, mode="balanced", max_loops=5)
114
  print(out["route"])
115
- # Each dict includes: answer, confidence, probabilities, loops_used,
116
- # halt_score, escalate_prob, state_drift, flipped_from_L1, latency_ms
117
 
118
  # 2. Batched active-set compaction across independent (state, question) pairs
119
  batch_out = engine.decide_batch(
@@ -122,7 +129,7 @@ batch_out = engine.decide_batch(
122
  )
123
 
124
  # 3. Anytime streaming with a strict latency budget (yields Pass 1..5 refinements)
125
- for step in engine.decide_anytime(state, questions["route"], deadline_ms=120.0):
126
  if step["is_final"]:
127
  print(step["answer"], step["loops_used"], step["readout"], step["escalate_prob"])
128
  ```
@@ -131,77 +138,96 @@ for step in engine.decide_anytime(state, questions["route"], deadline_ms=120.0):
131
 
132
  ## Benchmarks
133
 
134
- All numbers below come directly from the frozen Super-Epoch 1 evaluation (`v5_ep1_report.json`).
135
 
136
- ### 1. Accuracy Across Loops 1 → 5
137
 
138
  | Split | $n$ | Loop 1 (24L) | Loop 2 (36L) | Loop 3 (48L) | Loop 4 (60L) | **Loop 5 (72L)** | Δ vs. L1 |
139
  |---|---:|---:|---:|---:|---:|---:|---:|
140
- | `decision-v7/dev` | 1,468 | 82.22% | 85.08% | **85.29%** | 84.81% | 84.74% | +3.07 pp |
141
- | `decision-v7/test` | 1,440 | 83.68% | 86.32% | 86.88% | **87.15%** | **87.15%** | **+3.47 pp** |
142
- | `hard-v1/dev` *(OOD)* | 1,083 | 46.26% | 64.45% | 68.79% | 69.16% | **69.44%** | **+23.18 pp** |
143
- | `hard-v1/test` *(OOD)* | 1,088 | 51.29% | 68.20% | 72.98% | **73.53%** | **73.53%** | **+22.24 pp** |
144
 
145
- ### 2. `hard-v1/test` Subcategory Breakdown ($n=1{,}088$)
146
 
147
  | Subcategory | $n$ | Loop 1 | Loop 3 | **Loop 5** | Gain (L1 → L5) |
148
  |---|---:|---:|---:|---:|---:|
149
- | `hard_tradeoff` | 200 | 75.5% | **97.0%** | 96.5% | +21.0 pp |
150
- | `hard_probability` | 158 | 56.3% | **81.0%** | **81.0%** | **+24.7 pp** |
151
- | `hard_judge` | 188 | 60.6% | 73.4% | **75.0%** | +14.4 pp |
152
- | `hard_ambiguous` | 100 | 48.0% | 71.0% | **72.0%** | **+24.0 pp** |
153
- | `hard_multi_hop` | 125 | 36.0% | 64.0% | **67.2%** | **+31.2 pp** |
154
- | `hard_long_policy` | 200 | 31.0% | **63.5%** | **63.5%** | **+32.5 pp** |
155
- | `hard_temporal_numeric` | 117 | 41.9% | **47.9%** | 47.0% | +5.1 pp |
156
 
157
- ### 3. Conformal Risk Control (95% Clopper-Pearson UCBs on Calibration)
158
 
159
- A "fixable early error" occurs when the model exits early with a wrong answer that Loop 5 answers correctly.
160
 
161
- | Split & Mode | Threshold (`h_tau`) | Cal 95% UCB | Acc | Avg Loops | L1 Exit | L5 Exit | Fixable Early Errors | Lucky Exits |
162
  |---|---:|---:|---:|---:|---:|---:|---:|---:|
163
- | `v7/test` — `fast` | `0.93` | 1.79% | 85.90% | **1.46** | **70.8%** | 4.0% | 28 / 1,440 (1.94%) | 10 |
164
- | `v7/test` — `balanced` / `strict` | `0.99` | **0.41%** | **86.81%** | **2.13** | **52.5%** | 20.3% | **7 / 1,440 (0.49%)** | 2 |
165
- | `hard-v1/test` — `fast` | `0.93` | 1.79% | 69.39% | 2.57 | 25.4% | 18.0% | 59 / 1,088 (5.42%) | 14 |
166
- | `hard-v1/test` — `balanced` / `strict` | `0.99` | **0.41%** | **72.15%** | 3.48 | 10.7% | 45.0% | **16 / 1,088 (1.47%)** | 1 |
167
- | `hard-v1/dev` — `balanced` / `strict` | `0.99` | **0.41%** | **68.61%** | 3.88 | 3.6% | 56.6% | **9 / 1,083 (0.83%)** | 0 |
 
168
 
169
  ### 4. Tri-State Cognitive Control: Selective Accuracy vs. Coverage
170
 
171
- Ranking questions by `EscalationHead` (`escalate_prob`) lets the system escalate the highest-risk slice to a System 2 model while answering the remaining questions autonomously.
172
 
173
  ![Tri-State Selective Escalation and Generational Progress](assets/selective_escalation.png)
174
 
175
  | Split (Base L5 / AUROC) | Escalation Rate | Coverage | Autonomous Acc | 95% LCB | Error Recall | Oracle S2 Combined Acc |
176
  |---|---:|---:|---:|---:|---:|---:|
177
- | `v7/test` (`87.15%` / `AUROC 0.7505`) | 5% | 95.0% | **88.52%** | 87.01% | 15.1% | 89.10% |
178
- | `v7/test` (`87.15%` / `AUROC 0.7505`) | 10% | 90.0% | **89.81%** | 88.33% | 28.6% | 90.83% |
179
- | `v7/test` (`87.15%` / `AUROC 0.7505`) | 15% | 85.0% | **90.77%** | 89.29% | 38.9% | 92.15% |
180
- | `v7/test` (`87.15%` / `AUROC 0.7505`) | 20% | 80.0% | **91.49%** | 90.02% | 47.0% | **93.19%** |
181
- | `hard-v1/test` (`73.53%` / `AUROC 0.7437`) | 5% | 95.0% | **75.53%** | 73.23% | 12.2% | 76.75% |
182
- | `hard-v1/test` (`73.53%` / `AUROC 0.7437`) | 10% | 90.0% | **77.02%** | 74.70% | 21.9% | 79.32% |
183
- | `hard-v1/test` (`73.53%` / `AUROC 0.7437`) | 15% | 85.0% | **78.27%** | 75.92% | 30.2% | 81.53% |
184
- | `hard-v1/test` (`73.53%` / `AUROC 0.7437`) | 20% | 80.0% | **80.11%** | 77.76% | 39.9% | **84.10%** |
185
-
186
- ### 5. Reference Compiled Latency Baseline (v1/v3 on RTX PRO 6000, `torch.compile`)
187
-
188
- These latency numbers measure the v1/v3 compiled runner on `decision-v7/test` (average 223 tokens). Dedicated `v5.0` / `v5.1` CUDA engine benchmarks (`decide_multi`, `decide_batch`, `decide_anytime`) will publish with the `v5.1` release.
189
-
190
- | Mode | Median (p50) | Mean | Notes |
191
- |---|---:|---:|---|
192
- | Fixed Loop 1 (24L) | **65.6 ms** | 70.1 ms | 2.09× faster than Loop 3 |
193
- | Fixed Loop 2 (36L) | **100.2 ms** | 107.0 ms | 1.37× faster than Loop 3 |
194
- | Fixed Loop 3 (48L) | **136.8 ms** | 146.3 ms | Full 3-pass baseline |
195
- | Early Exit (`τ = 0.90`, 3-loop cap) | **81.4 ms** | 97.4 ms | **1.68×** faster median than Loop 3 |
196
- | Batched (`bs = 8`, `causal_conv1d`) | **27.9 / 61.4 ms/q** | — | **35.8 / 16.3 q/s** (Loop 1 / Loop 3) |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
 
198
  ---
199
 
200
- ## Limitations & Next Release
201
 
202
- - **Calendar and multi-step date arithmetic:** `hard_temporal_numeric` stands at `47.0%` on `hard-v1/test`. Exact date subtraction and multi-step billing arithmetic still benefit from external tool execution or escalation.
203
- - **OOD early-exit safety:** Calibration is tight in-distribution (`v7/test` ECE `0.0291`, `0.49%` fixable errors), while OOD `fast` mode allows `5.42%` fixable errors on `hard-v1/test`. Use `mode="balanced"` or `mode="strict"` for high-stakes OOD traffic.
204
- - **Next release (`v5.1`):** Super-Epoch 2 training on an additional 18,655 disjoint rows, followed by 4-upgrade Weight Space Programming (multi-donor block surgery, 5-point AdaLN drift correction, counterfactual halting risk optimization, and within-domain escalation ranking + Platt calibration) and full `System15Engine` CUDA benchmarks.
205
 
206
  ## License
207
 
 
10
  - early-exit
11
  - conformal-risk-control
12
  - selective-escalation
13
+ - weight-space-programming
14
  - moe
15
  ---
16
 
17
+ # Inkling-2-Mini Decision v5.1 (`eltokh7/inkling-2-mini-decision`)
18
 
19
  ![Should we have System 1.5 models?](assets/header.jpg)
20
 
21
  ## Overview
22
 
23
+ `Inkling-2-Mini Decision v5.1` is an adaptive-depth decision model built on [thinkingmachines/Inkling-2-Mini](https://huggingface.co/thinkingmachines/Inkling-2-Mini) (26.4B total parameters, **3.4B–5.4B active MoE**).
24
 
25
  The model reads a state and one or more typed questions (`choice`, `noul` yes/no, or `score`) in one forward pass. It outputs calibrated probabilities and generates **zero output tokens**.
26
 
27
+ The middle 12 layers run in a loop between **1 and 5 times** (24 to 72 logical layers). Simple questions stop after 1 pass. Hard multi-step questions loop deeper before the model answers. After Loop 5, a calibrated escalation head estimates whether to route the question to a slower System 2 model.
28
+
29
+ `v5.1` combines two disjoint multi-teacher training epochs (`Super-Epoch 1` + `Super-Epoch 2`) with zero-overhead **Weight Space Programming (Astra Stage 8A/8B WSP)** and ships with the production **`System15Engine`** (`modeling.py`).
30
 
31
  ---
32
 
33
  ## Key Results
34
 
35
+ `v5.1` delivers major gains in adaptive halting speed, conformal safety, calibration, escalation ranking (`AUROC = 0.8102`), and held-out hard dev/numeric/judge accuracy. The table below compares every generation transparently, including the exact `v5.0` vs. `v5.1` tradeoffs.
36
 
37
+ | Benchmark / Metric | v1 (3L) | v3 (5L) | v4 (5L) | v5.0 (Ep 1) | **v5.1 (Ep 2 + Astra WSP)** | Reference baselines |
38
+ |---|---:|---:|---:|---:|---:|---|
39
+ | **`decision-v7/test`** ($n=1{,}440$) | 85.56% | 86.67% | 86.94% | **87.15%** *(L5)* | 86.67% *(L3)* / 86.25% *(L5)* | `Kev-27B` (27B dense): 86.3% |
40
+ | **`hard-v1/test`** ($n=1{,}088$, *OOD*) | 66.82% | 71.42% *(L3)* | 72.79% *(L5)* | **73.53%** *(L5)* | **72.98%** *(L5, strictly monotonic)* | `Kev-9B v1` (9B dense): 58.4% |
41
+ | **`hard-v1/dev`** ($n=1{,}083$, *OOD*) | 66.67% | 69.16% *(L3)* | 68.33% *(L5)* | 69.44% *(L5)* | **70.45%** *(L5 — new high)* | `Kev-9B v1`: 58.2% · `Jev`: 78% |
42
+ | **`v7/test` Conformal `balanced`** | — | 86.39% @ 2.41L | — | 86.81% @ 2.13L | **86.11% @ 1.75L** *(0.42% fixable)* | 65% loop savings vs. L5 |
43
+ | **`hard-v1/test` Conformal `balanced`** | — | 69.03% @ 3.62L | — | 72.15% @ 3.48L | **72.52% @ 3.10L** *(0.83% fixable)* | Nearly 2× fewer fixable errors |
44
+ | **`v7/test` Escalation AUROC / Top-20%** | — | — | — | 0.7505 / 91.49% | **0.8102 / 92.88%** *(Oracle S2: 94.31%)* | +0.060 AUROC via Astra WSP |
45
+ | **`hard-v1/test` Escalation AUROC / Top-20%** | — | — | — | 0.7437 / 80.11% | **0.7545 / 79.89%** *(Oracle S2: 83.92%)* | Calibrated `p_esc` (26.3% vs 27.0% err) |
46
 
47
+ ### What `v5.1` Improves Over `v5.0` (and Tradeoffs)
48
 
49
+ 1. **Much faster and safer adaptive halting:** On `decision-v7/test`, `balanced` mode drops average depth from `2.13` to **`1.75` loops** with only **6 / 1,440 (`0.42%`)** fixable early errors. On `hard-v1/test`, `balanced` mode rises from `72.15% @ 3.48L` (`16` fixable errors) to **`72.52% @ 3.10L`** (**9 / 1,088 = `0.83%`** fixable errors), and `strict` mode reaches **`72.70% @ 3.18L`** with only **7** fixable errors (`0.64%`).
50
+ 2. **Record escalation ranking and true probability calibration:** Within-domain pairwise ranking + baked OOF Platt scaling lifts `decision-v7/test` escalation AUROC from `0.7505` to **`0.8102`** (**92.88%** autonomous accuracy at 20% escalation; **94.31%** with an oracle System 2) and aligns predicted `escalate_prob` with actual error rates (`14.5%` vs. `13.8%` on `v7/test`; `26.3%` vs. `27.0%` on `hard-v1/test`).
51
+ 3. **Stronger `hard-v1/dev` (`70.45%`), `hard_temporal_numeric` (`51.3%`), and `hard_judge` (`76.6%`):** `hard-v1/test` Loop 1 rises to `52.67%` and climbs monotonically to `72.98%` at Loop 5 (`ECE` drops from `0.0944` to **`0.0765`**).
52
+ 4. **Honest tradeoff vs. `v5.0`:** Raw Loop-5 accuracy on `v7/test` (`86.25%` vs. `87.15%`, peaking at `86.67%` on L3) and `hard-v1/test` (`72.98%` vs. `73.53%`) is ~0.5–0.9 pp below `v5.0`, while `v5.1` wins clearly on adaptive `hard-v1/test` accuracy, halting speed, calibration, `hard-v1/dev`, and escalation AUROC.
53
 
54
  ![Comparison on untrained hard-v1](assets/hard_v1_comparison.png)
55
 
 
68
  • CrossLoopTrajectoryMixer attends across loops 1..k
69
  • FullContextEvidencePooler pools 100% of state tokens into <= 64 chunks
70
  • JointSchemaHead outputs calibrated option probabilities
71
+ • EscalationHead predicts calibrated p_escalate for System 2 handoff
72
  ```
73
 
74
+ ### Architecture & Training Summary
75
 
76
+ - **Loop-Conditioned Shared Reasoning Expert (`LoopedSharedExpert` + `AdaLN-Zero(k)`):** A 170M-parameter dense SwiGLU expert runs in parallel with the frozen MoE experts across layers `6–17`. `AdaLN-Zero(k)` modulation (`scale_k`, `shift_k`, `gate_k`) gives each loop pass `k = 1..5` a distinct role.
77
+ - **Full-Context Evidence Pooling (`FullContextEvidencePooler`):** Pools **100% of state tokens** into up to 64 contiguous mean-pooled chunks with a residual projection before `JointSchemaHead` cross-attention.
78
+ - **Cross-Loop Trajectory Readout (`CrossLoopTrajectoryMixer`):** Causal attention across loops `1..k` lets later passes combine earlier findings instead of overwriting them.
79
+ - **Zero-Overhead Weight Space Programming (Astra Stage 8A/8B):** Optimized strictly on dev/fit splits (zero exposure to `test` splits): baked `0.85` `JointSchemaHead` logit calibration, 22-DOF counterfactual first-hit `DynamicHaltingHead` optimization, and 19-DOF within-domain pairwise-ranking + OOF Platt calibration for `EscalationHead`. All edits are baked directly into standard `heads.pt` tensors with zero inference overhead.
80
+ - **Standalone BF16 Weights:** All 218 unfrozen dynamic backbone tensors (`message_gate`, `moe_router`, `block_attn_res`, `message_input`, `final_norm`) and 120 LoRA tensors are merged into standalone BF16 safetensors (`v3-base` preserved as an immutable git tag).
81
 
82
  ---
83
 
 
89
  pip install "transformers>=5.24.0" torch huggingface_hub
90
  ```
91
 
92
+ Load `System15Engine` from `modeling.py`. It supports single queries, shared-state multi-question prefix caching, batched active-set compaction, and deadline-bounded anytime streaming:
93
 
94
  ```python
95
  from modeling import System15Engine
 
119
  # 1. Shared-state multi-question execution (runs prelude layers 0..5 on `state` once)
120
  out = engine.decide_multi(state, questions, mode="balanced", max_loops=5)
121
  print(out["route"])
122
+ # Returns: answer, confidence, probabilities, loops_used, halt_score,
123
+ # escalate_prob, state_drift, flipped_from_L1, latency_ms
124
 
125
  # 2. Batched active-set compaction across independent (state, question) pairs
126
  batch_out = engine.decide_batch(
 
129
  )
130
 
131
  # 3. Anytime streaming with a strict latency budget (yields Pass 1..5 refinements)
132
+ for step in engine.decide_anytime(state, questions["route"], deadline_ms=160.0):
133
  if step["is_final"]:
134
  print(step["answer"], step["loops_used"], step["readout"], step["escalate_prob"])
135
  ```
 
138
 
139
  ## Benchmarks
140
 
141
+ All accuracy, conformal, and escalation numbers come from the one-shot frozen evaluation (`v5_final_champion_report.json`). All GPU timing numbers come from real NVIDIA RTX PRO 6000 Blackwell 96 GB measurements (`bench_v5_results.json`).
142
 
143
+ ### 1. Accuracy Across Loops 1 → 5 (`v5.1`)
144
 
145
  | Split | $n$ | Loop 1 (24L) | Loop 2 (36L) | Loop 3 (48L) | Loop 4 (60L) | **Loop 5 (72L)** | Δ vs. L1 |
146
  |---|---:|---:|---:|---:|---:|---:|---:|
147
+ | `decision-v7/dev` | 1,468 | 81.54% | 84.47% | **84.88%** | 84.81% | **84.88%** | +3.34 pp |
148
+ | `decision-v7/test` | 1,440 | 84.44% | 86.04% | **86.67%** | 86.25% | 86.25% | +2.23 pp *(L3)* |
149
+ | `hard-v1/dev` *(OOD)* | 1,083 | 48.01% | 65.74% | **70.45%** | **70.45%** | **70.45%** | **+22.44 pp** |
150
+ | `hard-v1/test` *(OOD)* | 1,088 | 52.67% | 67.74% | 72.33% | 72.89% | **72.98%** | **+20.31 pp** |
151
 
152
+ ### 2. `hard-v1/test` Subcategory Breakdown ($n=1{,}088$, `v5.1`)
153
 
154
  | Subcategory | $n$ | Loop 1 | Loop 3 | **Loop 5** | Gain (L1 → L5) |
155
  |---|---:|---:|---:|---:|---:|
156
+ | `hard_tradeoff` | 200 | 76.5% | 95.0% | **95.5%** | +19.0 pp |
157
+ | `hard_probability` | 158 | 59.5% | **77.2%** | **77.2%** | +17.7 pp |
158
+ | `hard_judge` | 188 | 61.7% | 73.9% | **76.6%** | +14.9 pp |
159
+ | `hard_ambiguous` | 100 | 52.0% | **72.0%** | **72.0%** | +20.0 pp |
160
+ | `hard_multi_hop` | 125 | 36.8% | **63.2%** | **63.2%** | **+26.4 pp** |
161
+ | `hard_long_policy` | 200 | 31.5% | **63.5%** | 63.0% | **+31.5 pp** |
162
+ | `hard_temporal_numeric` | 117 | 41.9% | 49.6% | **51.3%** | **+9.4 pp** |
163
 
164
+ ### 3. Conformal Risk Control (Simultaneous Bonferroni 95% Clopper-Pearson UCBs)
165
 
166
+ Thresholds are frozen before reading calibration labels and certified once on `decision-v7/calibration` ($n=1{,}148$) with simultaneous Bonferroni correction ($\alpha = 0.05 / 3$).
167
 
168
+ | Split & Mode | Threshold | Cal Bonf 95% UCB | Acc | Avg Loops | L1 Exit | L5 Exit | Fixable Early Errors | Lucky Exits |
169
  |---|---:|---:|---:|---:|---:|---:|---:|---:|
170
+ | `v7/test` — `fast` | `0.923` | 1.19% | 85.97% | **1.52** | **61.0%** | 0.4% | 15 / 1,440 (1.04%) | 11 |
171
+ | `v7/test` — `balanced` | `0.969` | **0.67%** | **86.11%** | **1.75** | **51.4%** | 3.1% | **6 / 1,440 (0.42%)** | 4 |
172
+ | `v7/test` — `strict` | `0.974` | **0.67%** | **86.18%** | **1.82** | 48.1% | 4.2% | **5 / 1,440 (0.35%)** | 4 |
173
+ | `hard-v1/test` — `fast` | `0.923` | 1.19% | 71.78% | 2.69 | 10.1% | 9.1% | 21 / 1,088 (1.93%) | 8 |
174
+ | `hard-v1/test` — `balanced` | `0.969` | **0.67%** | **72.52%** | **3.10** | 4.3% | 22.1% | **9 / 1,088 (0.83%)** | 4 |
175
+ | `hard-v1/test` — `strict` | `0.974` | **0.67%** | **72.70%** | **3.18** | 3.0% | 24.4% | **7 / 1,088 (0.64%)** | 4 |
176
 
177
  ### 4. Tri-State Cognitive Control: Selective Accuracy vs. Coverage
178
 
179
+ Ranking questions by `EscalationHead` (`escalate_prob`) routes the highest-risk slice to a System 2 model while answering the rest autonomously.
180
 
181
  ![Tri-State Selective Escalation and Generational Progress](assets/selective_escalation.png)
182
 
183
  | Split (Base L5 / AUROC) | Escalation Rate | Coverage | Autonomous Acc | 95% LCB | Error Recall | Oracle S2 Combined Acc |
184
  |---|---:|---:|---:|---:|---:|---:|
185
+ | `v7/test` (`86.25%` / **`AUROC 0.8102`**) | 5% | 95.0% | **88.16%** | 86.62% | 18.2% | 88.75% |
186
+ | `v7/test` (`86.25%` / **`AUROC 0.8102`**) | 10% | 90.0% | **89.74%** | 88.24% | 32.8% | 90.76% |
187
+ | `v7/test` (`86.25%` / **`AUROC 0.8102`**) | 15% | 85.0% | **91.26%** | 89.81% | 46.0% | 92.57% |
188
+ | `v7/test` (`86.25%` / **`AUROC 0.8102`**) | 20% | 80.0% | **92.88%** | 91.51% | **58.6%** | **94.31%** |
189
+ | `hard-v1/test` (`72.98%` / **`AUROC 0.7545`**) | 5% | 95.0% | **74.56%** | 72.24% | 10.5% | 75.83% |
190
+ | `hard-v1/test` (`72.98%` / **`AUROC 0.7545`**) | 10% | 90.0% | **76.71%** | 74.38% | 22.4% | 79.04% |
191
+ | `hard-v1/test` (`72.98%` / **`AUROC 0.7545`**) | 15% | 85.0% | **78.16%** | 75.81% | 31.3% | 81.43% |
192
+ | `hard-v1/test` (`72.98%` / **`AUROC 0.7545`**) | 20% | 80.0% | **79.89%** | 77.52% | **40.5%** | **83.92%** |
193
+
194
+ ### 5. Real GPU Engine Benchmarks (`System15Engine` on RTX PRO 6000 Blackwell 96 GB, Eager BF16)
195
+
196
+ Measured directly on `v5.1` (`bench_v5_results.json`, mixed `test.jsonl` + `hard_test.jsonl` prompts, warmup + `torch.cuda.synchronize()`, eager BF16 without `torch.compile`):
197
+
198
+ **Single-Query Latency & Adaptive Early Exit:**
199
+
200
+ | Mode | Median (p50) | p90 | Avg Loops | Speedup vs. L5 |
201
+ |---|---:|---:|---:|---:|
202
+ | Fixed Loop 1 (24L) | **122.5 ms** | 136.6 ms | 1.00 | 3.33× |
203
+ | Fixed Loop 2 (36L) | **191.3 ms** | 214.9 ms | 2.00 | 2.13× |
204
+ | Fixed Loop 3 (48L) | **266.9 ms** | 298.1 ms | 3.00 | 1.53× |
205
+ | Fixed Loop 4 (60L) | **335.9 ms** | 373.7 ms | 4.00 | 1.21× |
206
+ | Fixed Loop 5 (72L) | **408.0 ms** | 452.1 ms | 5.00 | 1.00× |
207
+ | Adaptive `fast` | **212.8 ms** | 243.1 ms | 2.38 | **1.92×** |
208
+ | Adaptive `balanced` | **217.4 ms** | 301.5 ms | 2.75 | **1.88×** |
209
+
210
+ **Shared-State Prefix Caching (`decide_multi`) & Batched Active-Set Compaction (`decide_batch`):**
211
+
212
+ | Capability & Workload | Engine Time | Baseline Time | Measured Speedup | Notes |
213
+ |---|---:|---:|---:|---|
214
+ | `decide_multi` (`Q = 2` on shared long policy) | **284.9 ms** | 516.8 ms *(seq)* | **1.81×** | Prelude runs once on shared state |
215
+ | `decide_multi` (`Q = 4` on shared long policy) | **554.5 ms** | 1,316.8 ms *(seq)* | **2.38×** | Prelude runs once on shared state |
216
+ | `decide_multi` (`Q = 8` on shared long policy) | **838.4 ms** | 2,633.5 ms *(seq)* | **3.14×** | `104.8 ms/question` effective |
217
+ | `decide_batch` (`B = 4`, mixed easy+hard) | **979.8 ms** | 1,364.2 ms *(full L5)* | **1.39×** | Active set: `[4, 4, 3, 1, 1]` |
218
+ | `decide_batch` (`B = 8`, mixed easy+hard) | **1,580.1 ms** | 2,721.0 ms *(full L5)* | **1.72×** | Active set: `[8, 8, 5]` (`1.25×` vs seq) |
219
+ | `decide_batch` (`B = 16`, mixed easy+hard) | **3,355.9 ms** | 5,605.0 ms *(full L5)* | **1.67×** | Active set: `[16, 16, 10, 1, 1]` |
220
+
221
+ **Anytime Deadline Streaming (`decide_anytime`, mixed prompts):**
222
+ `deadline_ms = 80 ms` → `1.0L` (`62.5%` acc) · `120 ms` → `2.0L` (`75.0%`) · `160 ms` → `2.0L` (`75.0%`) · `220 ms` → `3.0L` (`87.5%`).
223
 
224
  ---
225
 
226
+ ## Limitations
227
 
228
+ - **Calendar and multi-step numeric arithmetic:** `hard_temporal_numeric` improved to `51.3%` on `hard-v1/test` (`+4.3 pp` over `v5.0`), yet exact date subtraction and multi-step billing math still benefit from external code execution or System 2 escalation.
229
+ - **Eager vs. compiled latency:** The `bench_v5_results.json` GPU numbers above use eager PyTorch BF16 (`~122 ms` L1 / `~217 ms` balanced on RTX PRO 6000). Adding `torch.compile` and `causal_conv1d` reduces per-pass latency further (the compiled v1/v3 runner measured `65.6 ms` L1 / `136.8 ms` L3).
230
+ - **OOD early-exit selection:** Conformal guarantees apply to the in-distribution calibration split. For high-stakes OOD traffic, use `mode="balanced"` (`0.83%` fixable errors on `hard-v1/test`) or `mode="strict"` (`0.64%` fixable errors) together with `escalate_prob` routing.
231
 
232
  ## License
233
 
assets/hard_v1_comparison.png CHANGED

Git LFS Details

  • SHA256: 0fc1a2bef5a084508b907bf74419f2443426ee693007870acadaae4291bfa0be
  • Pointer size: 131 Bytes
  • Size of remote file: 373 kB

Git LFS Details

  • SHA256: 4f1b1676f61c1a2c80c179e82d67c695af02e0e8f66b2b834e899185e9496e8e
  • Pointer size: 131 Bytes
  • Size of remote file: 402 kB
assets/header.jpg CHANGED

Git LFS Details

  • SHA256: ffc55b89f995ada0fc61f84c2b23128972bed4a8db715e1550fbe355463ecc81
  • Pointer size: 131 Bytes
  • Size of remote file: 998 kB

Git LFS Details

  • SHA256: 7e2d9364d7e438044f5cd8613bda02dfb610507aa408a8fa1ff5d8b3bc4f3e67
  • Pointer size: 131 Bytes
  • Size of remote file: 995 kB
assets/selective_escalation.png CHANGED

Git LFS Details

  • SHA256: 5d0d4aab6ebc9cb8fdb3fee853d709cda431a23c8863f4745b528650e4f11976
  • Pointer size: 131 Bytes
  • Size of remote file: 399 kB

Git LFS Details

  • SHA256: 46b9ec05f7ad4f2d2c58f8e2a415db45703031238c7a4fd581db63326a1aaede
  • Pointer size: 131 Bytes
  • Size of remote file: 417 kB
modeling.py CHANGED
@@ -477,23 +477,34 @@ def _slice_mask_for_compaction(
477
  new_T: int,
478
  cur_T: int,
479
  ) -> Any:
480
- """Slice a mask/tensor cleanly along batch (if batch-dim == cur_B) and sequence dims."""
481
  if m is None or not isinstance(m, torch.Tensor):
482
  return m
483
  out = m
 
 
 
 
 
 
 
484
  if out.ndim >= 2 and out.shape[0] == cur_B:
485
  out = out.index_select(0, keep_idx)
486
  if new_T < cur_T:
487
  if out.ndim == 2 and out.shape[1] == cur_T:
488
  out = out[:, :new_T]
489
  elif out.ndim == 3:
490
- if out.shape[1] == cur_T and out.shape[2] == cur_T:
491
  out = out[:, :new_T, :new_T]
492
- elif out.shape[1] == cur_T:
493
  out = out[:, :new_T, :]
 
 
494
  elif out.ndim == 4:
495
  if out.shape[-2] == cur_T and out.shape[-1] == cur_T:
496
  out = out[..., :new_T, :new_T]
 
 
497
  elif out.shape[-1] == cur_T:
498
  out = out[..., :new_T]
499
  return out
 
477
  new_T: int,
478
  cur_T: int,
479
  ) -> Any:
480
+ """Slice a mask/relative-distance tensor cleanly along batch and sequence dims."""
481
  if m is None or not isinstance(m, torch.Tensor):
482
  return m
483
  out = m
484
+ # 2D square [T, T] relative-distance tensor: slice BOTH sequence dims, never batch-index
485
+ if out.ndim == 2 and out.shape[0] == cur_T and out.shape[1] == cur_T and cur_B != cur_T:
486
+ return out[:new_T, :new_T] if new_T < cur_T else out
487
+ if out.ndim == 2 and out.shape[0] == cur_T and out.shape[1] == cur_T and out.dtype in (torch.int32, torch.int64) and out[0, 0] == 0:
488
+ # Even when cur_B == cur_T, relative_distance[0, 0] == 0 whereas attention_mask[0, 0] == 1
489
+ return out[:new_T, :new_T] if new_T < cur_T else out
490
+
491
  if out.ndim >= 2 and out.shape[0] == cur_B:
492
  out = out.index_select(0, keep_idx)
493
  if new_T < cur_T:
494
  if out.ndim == 2 and out.shape[1] == cur_T:
495
  out = out[:, :new_T]
496
  elif out.ndim == 3:
497
+ if out.shape[-2] == cur_T and out.shape[-1] == cur_T:
498
  out = out[:, :new_T, :new_T]
499
+ elif out.shape[-2] == cur_T:
500
  out = out[:, :new_T, :]
501
+ elif out.shape[-1] == cur_T:
502
+ out = out[:, :, :new_T]
503
  elif out.ndim == 4:
504
  if out.shape[-2] == cur_T and out.shape[-1] == cur_T:
505
  out = out[..., :new_T, :new_T]
506
+ elif out.shape[-2] == cur_T:
507
+ out = out[..., :new_T, :]
508
  elif out.shape[-1] == cur_T:
509
  out = out[..., :new_T]
510
  return out