tjdoomer commited on
Commit
928dfef
Β·
verified Β·
1 Parent(s): 66ca48b

Initial Model Card & Epistemic Drift Benchmarks

Browse files
Files changed (1) hide show
  1. README.md +149 -0
README.md ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: apache-2.0
5
+ tags:
6
+ - modernbert
7
+ - reasoning
8
+ - system2
9
+ - deliberation
10
+ - reranker
11
+ - code
12
+ - consensus
13
+ - calibration
14
+ metrics:
15
+ - accuracy
16
+ - brier_score
17
+ - ece
18
+ pipeline_tag: text-classification
19
+ ---
20
+
21
+ # System 2: 5-Head Deliberation & Epistemic Drift Detector (Code Track)
22
+
23
+ **System 2** is a non-autoregressive deliberation engine built on ModernBERT. It evaluates competing hypotheses across 5 parallel perspectives in under 30ms on Apple Silicon MPS or NVIDIA CUDA, calculates pairwise cosine cluster consensus, and detects epistemic drift before code execution.
24
+
25
+ - **Checkpoint:** `system2_code.pt` (143 MB)
26
+ - **Base Architecture:** `answerdotai/ModernBERT-Large-Instruct` (395M, frozen) + LoRA subspace adapters ($r=32, \alpha=32$ across layers 20-27) + 5 ThoughtHeads + Cross-attending Judger.
27
+ - **Guarded Metric (Code Traces):** `0.9010` (89.11% accuracy, 0.0891 Brier score, 0.0542 true 10-bin ECE).
28
+ - **Official Website:** [system2.online](https://system2.online)
29
+ - **GitHub Repository:** [github.com/tj-doomer-it/System2](https://github.com/tj-doomer-it/System2)
30
+
31
+ ---
32
+
33
+ ## The Problem: The 2-Bit CoT Collapse & Garbage In, Garbage Out (GIGO)
34
+
35
+ Crushing large models (27B+) to 2.0-bit (`UD-IQ2_XXS`) or 3.0-bit destroys the attention projection weights that emit the `</think>` closing token. In empirical testing on Apple Silicon (M4 Max), 2-bit models burned 95%+ of their token budgets inside internal reasoning loops, taking 8 to 9 minutes per stage and emitting empty or truncated code.
36
+
37
+ System 2 creates a new paradigm: **Pairing lightweight 4-bit small models (7B to 12B) with a 143 MB ModernBERT 5-head consensus harness on standard 16 GB laptops.**
38
+
39
+ ```text
40
+ [ User Prompt / Code Task ]
41
+ β”‚
42
+ β–Ό
43
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
44
+ β”‚ ⚑ FAST GENERATOR: 7B-12B 4-bit Model (e.g. Gemma 12B) β”‚
45
+ β”‚ β€’ Emits 4 parallel candidate hypotheses (~2-3s) β”‚
46
+ β”‚ β€’ High speed (50-70 tok/s), low VRAM (6.8 GB) β”‚
47
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
48
+ β”‚ (4 Candidate Hypotheses)
49
+ β–Ό
50
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
51
+ β”‚ 🧠 SYSTEM 2: 143 MB 5-Head Deliberation Network (MPS) β”‚
52
+ β”‚ β€’ Head 0: Holistic Context (Global integration) β”‚
53
+ β”‚ β€’ Head 1: Context-Anchored (40% Q / 60% A) β”‚
54
+ β”‚ β€’ Head 2: Choice-Forward (20% Q / 80% A) β”‚
55
+ β”‚ β€’ Head 3: Symmetric Balance (50% Q / 50% A) β”‚
56
+ β”‚ β€’ Head 4: Extreme Salience (5% Q / 95% A) β”‚
57
+ β”‚ β€’ Pairwise Cosine Consensus (Threshold >= 0.88) β”‚
58
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
59
+ β”‚
60
+ β”Œβ”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
61
+ β–Ό β–Ό
62
+ [ HIGH CERTAINTY ] [ EPISTEMIC DRIFT ]
63
+ (Cluster Agreement >= 88%) (Divergent Candidates)
64
+ β”‚ β”‚
65
+ β–Ό β–Ό
66
+ Execute Locally on 16GB Mac Smart Cloud Escalation
67
+ (Latency: < 4 seconds) (Fast-Fail under 4 seconds)
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Live Validation: Epistemic Drift Detection in Action
73
+
74
+ During multi-agent swarm testing constructing an in-memory `LRUTTLCache`, candidate subagents diverged into an internal debate over relative vs absolute TTL refresh logic:
75
+
76
+ - Candidate 1: 0 lines
77
+ - Candidate 2: 78 lines
78
+ - Candidate 3: 108 lines (scratchpad debate)
79
+ - Candidate 4: 7 lines
80
+
81
+ **System 2 Verdict:** Confidence collapsed from **98.7% down to 41.8%** across the 5 ThoughtHeads.
82
+ Because confidence fell below the 88% threshold, System 2 flagged **Epistemic Drift**, successfully catching that the local models were guessing and halting execution before deploying broken code.
83
+
84
+ ---
85
+
86
+ ## Quickstart
87
+
88
+ ### Installation
89
+
90
+ ```bash
91
+ pip install system2
92
+ ```
93
+
94
+ ### Python API
95
+
96
+ ```python
97
+ from sys2 import System2Engine
98
+
99
+ # Initialize on Apple Silicon GPU (mps) or NVIDIA GPU (cuda)
100
+ engine = System2Engine(device="mps")
101
+
102
+ # Adjudicate 4 competing code candidates
103
+ result = engine.adjudicate(
104
+ question="Select the correct, thread-safe implementation of an LRU cache eviction node:",
105
+ choices=[
106
+ candidate_a_code,
107
+ candidate_b_code,
108
+ candidate_c_code,
109
+ candidate_d_code,
110
+ ],
111
+ domain="code",
112
+ )
113
+
114
+ print(f"Winning Candidate: #{result.selected_index + 1}")
115
+ print(f"Calibrated Confidence: {result.confidence * 100:.1f}%")
116
+ print(f"5-Head Consensus: {result.head_consensus} Heads")
117
+ print(f"Deliberation Latency: {result.deliberation_latency_ms:.2f} ms")
118
+ ```
119
+
120
+ ### Drop-in Local OpenAI Proxy
121
+
122
+ Run System 2 as a drop-in bridge server for Cursor, Claude Code, Cline, or LangChain:
123
+
124
+ ```bash
125
+ python3 -m sys2.server --port 8000
126
+ ```
127
+
128
+ Point your OpenAI client base URL to `http://localhost:8000/v1`.
129
+
130
+ ---
131
+
132
+ ## Benchmarks: M4 Max (128 GB Unified Memory)
133
+
134
+ | Metric | Path A: `qwen-3.8-27b-smoll` | Path B: `qwen-3.8-27b-iq3xxs` | Path Gemma: `google/gemma-4-12b` |
135
+ | :--- | :--- | :--- | :--- |
136
+ | **Model Size / VRAM** | 2.0-bit (6.77 GB) | 3.0-bit (10.18 GB) | 4.0-bit (6.77 GB) |
137
+ | **Module 1 (Node)** | 99.7% Conf (41 lines) | 81.6% Conf (19 lines) | 76.6% Conf (22 lines) |
138
+ | **Module 2 (Cache)** | 94.2% Conf (18 lines) | 75.2% Conf (14 lines) | 98.7% Conf (37 lines) |
139
+ | **Module 3 (Test Suite)** | 99.6% Conf (31 lines) | 67.8% Conf (10 lines) | **41.8% Conf (Drift Flagged)** |
140
+ | **Deliberation Latency (MPS)**| 580ms | 982ms | 1,107ms |
141
+ | **Pytest Result** | FAILED (SyntaxError) | FAILED (IndentationError) | FAILED (Markdown list indent) |
142
+ | **Root Failure Cause** | 2-bit CoT loop truncation | 3-bit CoT loop truncation | Indented markdown list block |
143
+
144
+ ---
145
+
146
+ ## Citation & License
147
+
148
+ - **License:** Apache 2.0
149
+ - **Authors:** Thom James-Worrall / Antigravity Research