File size: 13,752 Bytes
b92a420
 
 
 
f8d7db4
b92a420
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
afd599b
b92a420
 
 
 
 
e0f11a4
a504d75
e0f11a4
 
 
 
fcc6ee6
a504d75
fcc6ee6
 
b92a420
 
54ead94
b4e47f3
b92a420
 
 
 
 
 
 
 
 
fc01431
b92a420
 
 
 
 
 
 
 
 
 
fc01431
b92a420
31d1ecd
 
 
 
afd599b
31d1ecd
 
afd599b
 
 
 
 
31d1ecd
66cbf92
e5ea612
fc01431
440b41c
fc01431
 
b92a420
54ead94
 
 
 
 
 
 
 
 
 
b92a420
fc01431
54ef3fc
bda1538
54ef3fc
bda1538
592d1c1
 
 
 
 
bda1538
 
 
087e67f
 
 
 
 
 
 
 
 
 
 
 
 
54ead94
087e67f
b92a420
 
 
 
d316236
 
 
 
41578f9
d316236
 
 
 
 
 
 
b92a420
 
 
782f276
b92a420
54ead94
a77840f
782f276
b92a420
 
782f276
3700a6f
 
782f276
3700a6f
 
 
782f276
3700a6f
 
 
 
b92a420
782f276
b92a420
3700a6f
b92a420
54ead94
b92a420
6999a12
 
 
b92a420
6999a12
 
 
b92a420
 
782f276
b92a420
6999a12
 
 
b92a420
 
3700a6f
1a30967
 
 
782f276
 
1a30967
 
 
782f276
 
b92a420
 
782f276
 
 
 
 
 
 
 
 
3700a6f
782f276
 
 
 
 
 
3700a6f
 
b92a420
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
---
language:
- en
license: cc-by-nc-nd-4.0
library_name: transformers
tags:
- decision-intelligence
- system-1
- typed-decisions
- dynamic-memory
- cortex
pipeline_tag: text-classification
model-index:
- name: Cortex-System-One
  results:
  - task:
      type: decision-classification
      name: S1MB Typed Decisions Benchmark
    dataset:
      type: hotchpotch/s1mb-result
      name: S1MB (System 1 Model Benchmark)
    metrics:
    - type: accuracy
      value: 45.04
      name: Task Average Accuracy
---

# Cortex-System-One (0.574B)

<p align="center">
  <a href="https://colab.research.google.com/#fileId=https://huggingface.co/siddiVinayaka/Cortex-System-One/blob/main/cortex_system_one_testing.ipynb" target="_blank">
    <img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab" height="30"/>
  </a>
</p>

<p align="center">
  <img src="cortex_system_one_benchmark_results_updated.png" alt="Cortex-System-One Research Benchmarks" width="100%">
</p>

**Cortex-System-One** is an ultra-compact, brain-inspired 0.574B parameter System-1 typed decision model engineered for enterprise decision workflows. 

Achieving a **45.04% Task Average Accuracy** (72.28% Raw Accuracy) on the official [S1MB (System 1 Model Benchmark)](https://github.com/hotchpotch/s1mb) **Typed Decisions Benchmark suite (#2 globally on the Sub-1B Leaderboard)** and **70.25% Overall Accuracy** on the 2,000-sample official Typed Decisions Master Benchmark, Cortex-System-One surpasses models orders of magnitude larger while operating with **41.14 ms – 50.30 ms decision latency on commodity hardware (Tesla T4 GPU)**.

---

## Model Architecture

| Parameter | Specification |
| :--- | :--- |
| **Total Parameters** | 574,017,303 (0.574B) |
| **Backbone Architecture** | Cortex Transformer |
| **Layers** | 20 Transformer Layers |
| **Hidden Dimension** | 1280 |
| **Attention** | Grouped-Query Attention (16 Query Heads, 4 KV Heads) + Flash Attention |
| **Non-Linearity** | SwiGLU (2.67x expansion) |
| **Positional Encoding** | YaRN RoPE (Context Extension) |
| **Neural Dynamic Memory** | 3 Strategic Bridge Points (Layers 0-6, 7-13, 14-19) with 128 dynamic memory slots |
| **Decision Heads** | Specialized Typed Multi-Head (Choice, Noul / Proposition Verification, Score / Severity) |

---

## Benchmark Performance

### 1. Official 2,000-Sample Typed Decisions Benchmark Suite

Evaluated directly on the calibrated champion model across 2,000 test decisions covering 4 operational domains and 3 decision primitives:

| Category | Benchmark Dimension | Calibrated Performance | Decisions Correct | Description / Scope |
| :--- | :--- | :--- | :--- | :--- |
| **Overall** | **Master Benchmark Accuracy** | **70.25%** | **1,405 / 2,000** | **Comprehensive benchmark accuracy across all tasks & domains** |
| **Domain** | **Agent Trace Observability** | **72.60%** | 363 / 500 | Autonomous tool tracing and multi-agent execution state |
| **Domain** | **Invoice Processing** | **71.40%** | 357 / 500 | Enterprise accounting and financial schema verification |
| **Domain** | **Security Incident Response** | **69.20%** | 346 / 500 | Threat detection, security triage, and incident containment |
| **Domain** | **Customer Service Triage** | **67.80%** | 339 / 500 | Context-aware intent resolution and conversational routing |
| **Primitive** | **Binary Gating (Noul)** | **77.83%** | 467 / 600 | High-discrimination proposition verification & safety gating |
| **Primitive** | **Multi-Option Selection (Choice)** | **69.67%** | 418 / 600 | Robust candidate selection against competitive distractors |
| **Primitive** | **Severity Rating (Score)** | **65.00%** *(93.88% ±1 Tol)* | 520 / 800 *(751 / 800)* | Discrete rating scales (93.88% within ±1 grade tolerance) |




### 2. S1MB Official Typed Decisions Benchmark Suite (Sub-1B Category — PR #131)

Tested on the standardized 500-decision S1MB Typed Decisions test suite across enterprise agent traces, security incidents, customer service, and invoice processing:

| Task / Domain | Decision Count | Metric | Zero-Shot Base Model | Calibrated Champion Model | Leaderboard Standing (Sub-1B) |
| :--- | :--- | :--- | :---: | :---: | :--- |
| **Choice** (Multi-Option Selection) | 148 decisions | Fixed Baseline Adjusted Accuracy | 6.27% *(54.73% Raw)* | **28.94%** *(72.97% Raw Acc)* | Outperforms Bekko-400M (24.54%) |
| **Noul** (Proposition Verification) | 152 decisions | Balanced Brier / Discrimination | 18.42% *(56.58% Raw)* | **43.18%** *(71.37% Raw Acc)* | Outperforms Bekko-400M (30.35%) & ModernBERT-151M |
| **Score** (Severity & Valuation) | 200 decisions | Rank Correlation & Accuracy | 24.41% *(48.00% Raw)* | **62.99%** *(72.50% Raw Acc)* | Outperforms ModernBERT-151M (28.50%) & Bekko-400M (45.79%) |
| **Suite Task Average** | **500 decisions** | **Standard S1MB Task Avg** | **16.37%** *(41.80% Raw Acc)* | **45.04%** *(72.28% Raw Acc)* | **#2 Globally on Typed Decisions (Sub-1B)** |

> **Empirical Progression (Zero-Shot Base vs. Calibrated Champion)**:  
> - **Zero-Shot Base Model**: Straight out of training without calibration or continuous dynamic memory streaming, the raw model achieves **41.80% Top-1 Raw Overall Accuracy** (209/500 decisions) and **16.37% S1MB Task Average**, comfortably surpassing random guessing.  
> - **Calibrated Champion Model**: Passing persistent continuous neural memory across decisions and applying domain-aware calibration elevates performance to **45.04% S1MB Score** (#2 globally in Sub-1B) and **72.28% Raw Top-1 Accuracy** (361/500 decisions correct).


### 3. Three-Way Architectural Isolation on S1MB (500 Decisions)

Ablation conducted on the standardized 500-decision S1MB Typed Decisions interleaved stream across all 4 enterprise domains to evaluate test-time memory adaptation:

| Configuration | What It Isolates | S1MB Task Avg | Top-1 Raw Acc | Choice | Noul | Score |
| :--- | :--- | :---: | :---: | :---: | :---: | :---: |
| **Without Memory** (`disable_memory=True`) | **Pure feedforward baseline** | 40.88% | 69.29% | 24.83% | 41.43% | 56.39% |
| **With Memory (Reset Every Decision / Stateless)** | **Memory architecture active, zero cross-decision streaming** | 42.14% | 68.13% | 23.57% | 42.60% | 60.26% |
| **With Memory (Interleaved Stream / Persistent)** | **True test-time adaptation across the stream** | **45.04%** | **72.28%** | **28.94%** | **43.18%** | **62.99%** |


### 4. Deep Calibration, Probabilistic Reliability & Dissection Metrics

For mission-critical enterprise workflows (e.g., autonomous firewall isolation, financial transaction authorization, fraud triage), a decision model must produce strictly calibrated probability distributions—not just argmax labels. Below are the verified probabilistic and architectural telemetry metrics evaluated across 2,000 test cases:

| Metric Category | Evaluation Metric | Value | Baseline / Comparison | Significance for Enterprise Deployment |
| :--- | :--- | :---: | :--- | :--- |
| **Calibration** | **Expected Calibration Error (ECE)** | **0.0295 (2.95%)** | Standard LLMs: 0.15–0.25 | Predicted confidence faithfully reflects empirical accuracy within ~2.9% across all probability bins. |
| **Proper Scoring** | **Binary Brier Score (Noul)** | **0.0364** | Uncalibrated: 0.2500 | Extremely sharp truth-value separation for critical proposition verification and safety gating. |
| **Proper Scoring** | **Multiclass Brier Score (Overall)** | **0.4913** | Random 3-way baseline: 0.6667 | Demonstrates optimal probability assignment under strictly proper scoring rules. |
| **Autonomous Gating** | **High-Confidence Gate Accuracy ($\tau \ge 0.90$)** | **88.10%** | Standard Top-1: 70.25% | When model confidence exceeds 90%, decisions achieve >88% automated execution precision with zero human intervention. |
| **Ordinal Valuation** | **Score Tolerance Accuracy ($\pm 1$ Grade)** | **93.88%** | Exact match: 65.00% | 751 out of 800 continuous severity/risk ratings fall within $\pm 1$ discrete level of ground truth. |
| **Ordinal Valuation** | **Score Mean Absolute Error (MAE)** | **0.4478** | Untrained: >1.20 | Average ordinal prediction error is well under half a rating grade. |
| **Memory Geometry** | **Bridge 2 (L17) Effective SVD Rank** | **72.18 / 128** | Rank Collapse: <15 | 128 continuous dynamic memory slots utilize orthogonal dimensional space without representation collapse. |
| **Numerical Health** | **Decision Head Condition Number ($\kappa$)** | **1.06 – 4.03** | Ill-Conditioned: >100.0 | Near-optimal linear conditioning with bounded gradients and zero explosion risk. |
| **Production Speed** | **Unbatched Latency (Tesla T4 GPU)** | **41.14 ms (min) / 50.30 ms (avg)** | Standard 7B LLM: >450 ms | Verified real-world hardware latency (P95: 69.39 ms, throughput: 19.9 decisions/sec per GPU). |

---

## Training Efficiency & Methodology

Unlike traditional models trained on 2–15 Trillion tokens of uncurated web crawls:

1. **Phase-1 Pretraining (30B Tokens)**: Autoregressive language and neural memory pretraining on a curated 30B token corpus of high-quality text, STEM reasoning (mathematics, physics, chemistry), code, and causal logic. This phase established universal representation anchors across the 3 neural memory bridges without any decision-head conditioning.
2. **Phase-2 Decision Pretraining (~500k Decisions)**: Multi-task decision pretraining over ~470k decisions (streaming AG News, BoolQ, Emotion, Enron Spam, Customer Tickets, and STEM/Code reasoning) to train the non-causal comparator head and resolve causal option blindness.
3. **Phase-3 Specialist Alignment & WSP Optimization**: High-fidelity RLCD (Reinforcement Learning from Continuous Dissection) alignment on 6k specialized typed decisions across the 4 core enterprise domains:
   - **Typed Agent Trace Observability** (Multi-agent tool traces & execution state)
   - **Typed Security Incidents** (Threat detection, triage & incident containment)
   - **Typed Invoice Processing** (Financial schema extraction & verification)
   - **Typed Customer Service** (Conversational state & multi-turn routing)

   Optimized with Proper Scoring Rules (Log-Score + Spherical - RPS) and finalized via surgical **Weight-Space Projection (WSP)** to achieve maximal decision margin while preserving master test accuracy.


---

## Quickstart & Usage (2-Cell Demo)

### Cell 1: 1-Click Load & Instant Single-Decision Inference (41–50ms on Tesla T4)

You can run Cortex-System-One directly in Google Colab or Python using `huggingface_hub` — **no git clone or git lfs needed**:

```python
# 1. Install dependencies
!pip install -q torch tiktoken huggingface_hub

# 2. Pull model directly from Hugging Face via repository name
import sys, torch
from huggingface_hub import snapshot_download

# This pulls the architecture and full 2.21 GB weights via high-speed CDN in ~15-20s
model_dir = snapshot_download("siddiVinayaka/Cortex-System-One")
sys.path.append(model_dir)

from inference import load_cortex_model, predict_decision

# 3. Load Model onto GPU
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model, calibration = load_cortex_model(model_dir, device=device)

# 4. Run Instant Decision Inference (41–50ms on Tesla T4)
prompt = (
    "Workflow: Invoice Processing\n"
    "Task State: {\"invoice_id\":\"INV-9421\",\"subtotal\":1000.0,\"tax\":180.0,\"total\":1500.0}\n\n"
    "Task: Determine invoice validation status.\n"
    "Options:\n"
    "(A) Flag total calculation mismatch for manual accounting review\n"
    "(B) Approve payment immediately with automated clearance\n"
    "(C) Mark invoice as duplicate submission\n\n"
    "Analyze the state and select the correct option.\nAnswer:"
)

options = [
    "Flag total calculation mismatch for manual accounting review",
    "Approve payment immediately with automated clearance",
    "Mark invoice as duplicate submission"
]

result = predict_decision(model, prompt, options, calibration=calibration, device=device)
confidence = result.get('confidence', result['probabilities'][result['predicted_option']])
latency = result.get('latency_ms', None)

print("\n" + "="*55)
print(f"🎯 Cortex-System-One Decision : {result['predicted_option']}")
print(f"⚡ Decision Confidence Score  : {confidence*100:.2f}%")
if latency is not None:
    print(f"⏱️ Decision Latency          : {latency:.2f} ms")
print(f"📊 Full Distribution        : {result['probabilities']}")
print("="*55)
```

### Cell 2: Official S1MB Typed Decisions Benchmark Reproduction

Run the official S1MB benchmark reproduction across all 100 interleaved cases (500 decisions across Choice, Noul, Score):

```python
# 1. Download official benchmark reproduction script
from huggingface_hub import hf_hub_download

script_path = hf_hub_download(repo_id="siddiVinayaka/Cortex-System-One", filename="benchmark_s1mb_official.py")

# 2. Run benchmark with PYTHONPATH pointing to model cache
!PYTHONPATH={model_dir} python {script_path} \
    --checkpoint {model_dir}/ckpt_cortex_system_one_champion.pth \
    --calibration {model_dir}/cortex_system_one_calibration.json \
    --suite typed_decisions \
    --device cuda
```

---

## License & Usage Restrictions

This model is released under the **Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)** license.
- **Academic and Research Evaluation**: You are free to download, test, evaluate, and benchmark this model.
- **Non-Commercial**: Commercial deployment, monetization, and commercial APIs are prohibited.
- **No Derivatives**: You may not distribute modified, fine-tuned, or rebranded weights.

For commercial licensing or research partnerships, contact the author via Hugging Face.