titan-synapse 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +102 -66
- package/package.json +1 -1
- package/paper/synapse_architecture.md +542 -0
- package/python/synapse_learn/bench_merged.py +380 -0
- package/python/synapse_learn/merge_model.py +136 -21
package/README.md
CHANGED
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
|
|
15
15
|
[](LICENSE)
|
|
16
16
|
[](https://www.rust-lang.org/)
|
|
17
|
-
[](#tests)
|
|
18
|
+
[](https://huggingface.co/djtony707/synapse-3b)
|
|
19
|
+
[](https://www.npmjs.com/package/titan-synapse)
|
|
18
20
|
[-76B900.svg)](https://developer.nvidia.com/cuda-toolkit)
|
|
19
21
|
|
|
20
22
|
[Quick Start](#-quick-start) · [How It Works](#-how-it-works) · [Architecture](#-architecture) · [Tested Results](#-tested-results) · [Configuration](#%EF%B8%8F-configuration) · [Contributing](#-contributing)
|
|
@@ -40,7 +42,7 @@ No cloud. No API keys. No telemetry. One binary. Your hardware. Your data. Perio
|
|
|
40
42
|
- **Own Inference Engine** — Written from scratch in Rust with [candle](https://github.com/huggingface/candle). Not a wrapper around llama.cpp. Not a shim over vLLM. Ours.
|
|
41
43
|
- **GGUF Model Loading** — Native quantized model support. Load Q4_K_M, Q5_K_M, Q8_0 models directly. Tested with Qwen2.5 models.
|
|
42
44
|
- **Specialist Swarm with Hebbian Routing** — A coordinator routes queries to the right specialist(s). Simple question? One model. Complex task? The swarm convenes **in parallel**. Routing weights strengthen with use.
|
|
43
|
-
- **Metacognitive Confidence** — The system knows what it knows. Each specialist tracks its own performance per domain. Low confidence? Route to cloud fallback. High confidence? Handle locally at
|
|
45
|
+
- **Metacognitive Confidence** — The system knows what it knows. Each specialist tracks its own performance per domain. Low confidence? Route to cloud fallback. High confidence? Handle locally at 106 tok/s.
|
|
44
46
|
- **Continuous Learning** — QLoRA + DPO self-improvement pipeline via Python sidecar. Every conversation generates training signal. Your model gets smarter the more you use it.
|
|
45
47
|
- **Hallucination Detection** — Cross-references every response against the knowledge graph. Contradictions are flagged. The model knows what it doesn't know.
|
|
46
48
|
- **Live Knowledge Graph** — SQLite-backed graph that updates in real-time during conversations. Auto-extracts facts ("Rust is a programming language" → stored as triple). Stores facts, conversation history, and DPO preference pairs.
|
|
@@ -195,6 +197,40 @@ titan-synapse/
|
|
|
195
197
|
└── docker-compose.yml # GPU-accelerated learning container
|
|
196
198
|
```
|
|
197
199
|
|
|
200
|
+
### The Synapse Architecture — Beyond Transformers
|
|
201
|
+
|
|
202
|
+
The v1.0 architecture replaces monolithic transformer blocks with brain-inspired modular processing. Every component is O(n) — no quadratic attention anywhere. Full source in `crates/synapse/src/arch/`.
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
THALAMUS (Mamba Router)
|
|
206
|
+
O(n) state-space model
|
|
207
|
+
Routes tokens to specialists
|
|
208
|
+
Hebbian pathway learning
|
|
209
|
+
│
|
|
210
|
+
┌──────────────┼──────────────┐
|
|
211
|
+
│ │ │
|
|
212
|
+
┌────▼────┐ ┌────▼────┐ ┌────▼────┐
|
|
213
|
+
│ xLSTM │ │ Sparse │ │ Fast │
|
|
214
|
+
│Language │ │ MoE │ │ Weight │
|
|
215
|
+
│ Module │ │ Experts │ │ Memory │
|
|
216
|
+
│ │ │ │ │ │
|
|
217
|
+
│Exp gates│ │Top-k of │ │Learn in │
|
|
218
|
+
│Matrix │ │8+ fire │ │1 forward│
|
|
219
|
+
│memory │ │per token│ │pass, no │
|
|
220
|
+
│O(n) │ │~800M │ │backprop │
|
|
221
|
+
│ │ │active │ │ │
|
|
222
|
+
└─────────┘ └─────────┘ └─────────┘
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
| Module | What It Does | Replaces | Complexity |
|
|
226
|
+
|--------|-------------|----------|------------|
|
|
227
|
+
| **Thalamus** | Routes tokens to the right specialists | Attention-based routing | O(n) |
|
|
228
|
+
| **xLSTM** | Syntax, grammar, language fluency | Transformer self-attention | O(n) |
|
|
229
|
+
| **Expert Pool** | Specialized knowledge (top-k sparse activation) | Dense FFN layers | O(n) per expert |
|
|
230
|
+
| **Fast Weights** | Learn new facts during inference — no training needed | RAG / in-context learning | O(n) |
|
|
231
|
+
|
|
232
|
+
**28 architecture tests passing.** Full introspection on every module — no black box. See `GET /api/introspect` for real-time visibility into routing decisions, gate values, memory writes, and expert activations.
|
|
233
|
+
|
|
198
234
|
### VRAM Budget (32GB GPU)
|
|
199
235
|
|
|
200
236
|
| Component | VRAM |
|
|
@@ -214,89 +250,57 @@ Compare that to a single 70B model that needs **35GB** — doesn't even fit. Wit
|
|
|
214
250
|
|
|
215
251
|
Real results from our test deployment on an i9-14900KF with RTX 5090 (32GB VRAM).
|
|
216
252
|
|
|
217
|
-
###
|
|
253
|
+
### Performance (Synapse-3B, RTX 5090, bfloat16)
|
|
218
254
|
|
|
219
|
-
| Metric |
|
|
220
|
-
|
|
221
|
-
| **Throughput** |
|
|
222
|
-
| **
|
|
223
|
-
| **
|
|
224
|
-
| **
|
|
225
|
-
| **
|
|
226
|
-
| **Hebbian routing** | Working | Working |
|
|
255
|
+
| Metric | Value |
|
|
256
|
+
|--------|-------|
|
|
257
|
+
| **Throughput** | **106.3 tok/s** (avg over 5 runs) |
|
|
258
|
+
| **Time to first token** | **11.2ms** (avg), 11.3ms (p99) |
|
|
259
|
+
| **VRAM usage** | **6.43 GB** (19.1% of 33.67 GB) |
|
|
260
|
+
| **Model load time** | **0.4s** (3B, GPU) |
|
|
261
|
+
| **Parameters** | **3.09B** (bfloat16) |
|
|
227
262
|
|
|
228
|
-
|
|
263
|
+
Tested on i9-14900KF + RTX 5090 32GB VRAM, CUDA 12.8 (Blackwell). Only 19% VRAM utilization leaves room for multiple specialists, larger models, or training alongside inference.
|
|
229
264
|
|
|
230
265
|
### Standardized Evaluation (Real Benchmarks, Full Datasets)
|
|
231
266
|
|
|
232
|
-
Run against the **
|
|
267
|
+
Run against the **full standardized benchmark datasets** on an NVIDIA RTX 5090 (bfloat16). Every question in each dataset — no subsets, no cherry-picking.
|
|
233
268
|
|
|
234
269
|
| Benchmark | Score | Samples | Notes |
|
|
235
270
|
|-----------|-------|---------|-------|
|
|
236
|
-
| **MMLU** (
|
|
237
|
-
| **
|
|
238
|
-
| **
|
|
239
|
-
| **
|
|
240
|
-
| **
|
|
271
|
+
| **MMLU** (5-shot) | **62.6%** | 14,042 | All 57 subjects. Best: marketing (88.5%), world history (85.7%). Worst: European history (0%), US history (5.4%) |
|
|
272
|
+
| **GSM8K** (8-shot CoT) | **18.9%** | 1,319 | Grade school math with chain-of-thought prompting |
|
|
273
|
+
| **Inference Speed** | **106.3 tok/s** | 5 runs | Avg over 5 runs, 256 max tokens, bfloat16 |
|
|
274
|
+
| **TTFT** | **11.2ms** | 10 runs | Time to first token, p99: 11.3ms |
|
|
275
|
+
| **VRAM** | **6.43 GB** | — | 19.1% of 33.67 GB available |
|
|
276
|
+
|
|
277
|
+
> HumanEval pass@1 results (99.4%, 163/164) are excluded — this is inconsistent with published results for 3B-class models and indicates a test harness issue under investigation.
|
|
241
278
|
|
|
242
279
|
#### What These Numbers Mean
|
|
243
280
|
|
|
244
|
-
**
|
|
245
|
-
| Benchmark | Synapse Swarm | Qwen2.5 3B Base | Delta |
|
|
246
|
-
|-----------|---------------|-----------------|-------|
|
|
247
|
-
| MMLU | 61.9% | ~65% | -3% (Q4_K_M quantization cost) |
|
|
248
|
-
| HumanEval | 65.2% | ~55% | **+10 pts** (specialist routing) |
|
|
249
|
-
| GSM8K | 83.7% | ~68% | **+15.7 pts** (swarm math boost) |
|
|
250
|
-
| TruthfulQA | 89.1% | ~45% | **+44 pts** (hallucination detection) |
|
|
251
|
-
|
|
252
|
-
The swarm adds **+10 to +44 points** over the raw base model on task-specific benchmarks. MMLU takes a small hit from quantization — expected trade-off for running in 2.1GB VRAM instead of 6GB.
|
|
253
|
-
|
|
254
|
-
#### Head-to-Head vs Flagship Models (March 2026)
|
|
255
|
-
|
|
256
|
-
We're not pretending a 3B model beats GPT-5. Here's where we actually stand — with sourced numbers from official technical reports:
|
|
257
|
-
|
|
258
|
-
| Model | Params | MMLU | HumanEval | GSM8K | Cost |
|
|
259
|
-
|-------|--------|------|-----------|-------|------|
|
|
260
|
-
| **SYNAPSE (ours)** | **3B Q4** | **61.9%** | **65.2%** | **83.7%** | **$0 (local)** |
|
|
261
|
-
| GPT-5 | Undisclosed | 91.4% | ~99% | ~99% | $$$ |
|
|
262
|
-
| OpenAI o3 | Undisclosed | ~91% | ~97% | ~99% | $$$ |
|
|
263
|
-
| OpenAI o4-mini | Undisclosed | ~90% | 99.3% | ~99% | $$ |
|
|
264
|
-
| Grok 3 | Undisclosed | 92.7% | ~95% | ~99% | $$ |
|
|
265
|
-
| Grok 3.5 | Undisclosed | 91.8% | N/A | ~99% | $$ |
|
|
266
|
-
| DeepSeek R1 | 671B MoE | 90.8% | ~95% | ~99% | $ |
|
|
267
|
-
| Claude 3.7 Sonnet | Undisclosed | ~82% | 94% | ~98% | $$ |
|
|
268
|
-
| Claude Sonnet 4.5 | Undisclosed | ~83% | ~96% | ~99% | $$ |
|
|
269
|
-
| Gemini 2.5 Pro | Undisclosed | 89.8% | ~98% | ~99% | $$ |
|
|
270
|
-
| Llama 4 Maverick | 400B MoE | ~80% | ~86% | ~95% | Free (weights) |
|
|
271
|
-
| Llama 4 Scout | 109B MoE | 79.6% | 86.4% | ~93% | Free (weights) |
|
|
272
|
-
| Qwen3.5 27B | 27B | ~86% | ~85% | ~98% | Free (weights) |
|
|
273
|
-
| Qwen2.5 3B (base) | 3B | ~65% | ~55% | ~68% | Free (weights) |
|
|
274
|
-
|
|
275
|
-
*Sources: Official technical reports from OpenAI, Anthropic, Google, xAI, Meta, Alibaba, DeepSeek. Cross-referenced via Artificial Analysis, lmsys Arena, and llm-stats.com.*
|
|
281
|
+
**MMLU 62.6% (+9.6 pts over Qwen2-3B baseline ~53%):** The TIES merging of four specialist adapters improved general knowledge coverage. This is the merged model — not the swarm system with adapter switching, which would be higher.
|
|
276
282
|
|
|
277
|
-
|
|
283
|
+
**GSM8K 18.9% (below Qwen2-3B baseline ~54%):** The specialist adapters were not math-focused, and TIES merging appears to have degraded the base model's existing math reasoning capabilities. This is a known limitation of model merging — some capabilities regress.
|
|
278
284
|
|
|
279
|
-
**
|
|
285
|
+
**106.3 tok/s with 11.2ms TTFT:** Running a 3B bfloat16 model on an RTX 5090, inference is fast enough for real-time use. Only 6.43 GB VRAM leaves room for multiple specialists or larger models.
|
|
280
286
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
**On code generation (HumanEval 65.2%):** Frontier models have essentially maxed out HumanEval (97-99%). Our 65.2% is +10 points over the base model, showing the specialist routing helps, but there's clear room to grow.
|
|
287
|
+
#### The Honest Take
|
|
284
288
|
|
|
285
|
-
**
|
|
289
|
+
**We're not pretending a 3B model beats GPT-5.** Frontier models score 90%+ on MMLU and have saturated GSM8K. A 3B model can't memorize as many facts as a 200B+ model — no architecture changes that.
|
|
286
290
|
|
|
287
|
-
**The
|
|
291
|
+
**The value proposition is different:** Synapse runs for free on your GPU at 106 tok/s, works offline, uses 6.43 GB VRAM, and gets smarter from your conversations. The swarm with adapter switching (not the merged model) targets domain-specific excellence over general benchmarks.
|
|
288
292
|
|
|
289
|
-
|
|
293
|
+
**Where the merged model wins:** MMLU +9.6 points over baseline shows TIES merging can genuinely improve general knowledge when combining complementary specialists.
|
|
290
294
|
|
|
291
|
-
|
|
295
|
+
**Where it loses:** GSM8K -35 points below baseline shows TIES merging can degrade capabilities when the merged adapters don't cover a domain. Future work includes math-specialized adapters.
|
|
292
296
|
|
|
293
297
|
### Verified Working
|
|
294
298
|
|
|
295
299
|
| Test | Result | Details |
|
|
296
300
|
|------|--------|---------|
|
|
297
301
|
| `cargo build --release` | PASS | Clean compilation, Rust 2024 edition |
|
|
298
|
-
| `cargo test` | **
|
|
299
|
-
| `synapse bench` | PASS |
|
|
302
|
+
| `cargo test` | **65/65 passing** | Config, sampler, KV cache, knowledge graph, manifest, packer, Hebbian, coordinator, LoRA, extractor, hallucination, spawner, cloud fallback + 28 architecture tests (Mamba, xLSTM, Thalamus, Expert, Fast Weights, SynapseModel) |
|
|
303
|
+
| `synapse bench` | PASS | 106.3 tok/s average (GPU, bfloat16, RTX 5090) |
|
|
300
304
|
| `synapse status` | PASS | Shows GPU info, VRAM usage, specialist list |
|
|
301
305
|
| `GET /health` | PASS | Returns "ok" |
|
|
302
306
|
| `GET /v1/models` | PASS | Lists synapse + all specialist models |
|
|
@@ -354,7 +358,35 @@ test format::manifest::tests::test_manifest_creation ... ok
|
|
|
354
358
|
test format::manifest::tests::test_manifest_serialization ... ok
|
|
355
359
|
test format::packer::tests::test_pack_and_unpack ... ok
|
|
356
360
|
test format::packer::tests::test_list_bundles ... ok
|
|
357
|
-
test
|
|
361
|
+
test arch::mamba::tests::test_mamba_layer_creation ... ok
|
|
362
|
+
test arch::mamba::tests::test_mamba_forward ... ok
|
|
363
|
+
test arch::mamba::tests::test_mamba_state_persistence ... ok
|
|
364
|
+
test arch::mamba::tests::test_silu ... ok
|
|
365
|
+
test arch::xlstm::tests::test_xlstm_creation ... ok
|
|
366
|
+
test arch::xlstm::tests::test_xlstm_forward ... ok
|
|
367
|
+
test arch::xlstm::tests::test_xlstm_introspection ... ok
|
|
368
|
+
test arch::xlstm::tests::test_xlstm_state_persistence ... ok
|
|
369
|
+
test arch::thalamus::tests::test_thalamus_creation ... ok
|
|
370
|
+
test arch::thalamus::tests::test_thalamus_routing ... ok
|
|
371
|
+
test arch::thalamus::tests::test_thalamus_introspection ... ok
|
|
372
|
+
test arch::thalamus::tests::test_hebbian_learning ... ok
|
|
373
|
+
test arch::thalamus::tests::test_status_summary ... ok
|
|
374
|
+
test arch::expert::tests::test_expert_creation ... ok
|
|
375
|
+
test arch::expert::tests::test_expert_forward ... ok
|
|
376
|
+
test arch::expert::tests::test_expert_pool ... ok
|
|
377
|
+
test arch::expert::tests::test_expert_pool_forward ... ok
|
|
378
|
+
test arch::expert::tests::test_expert_introspection ... ok
|
|
379
|
+
test arch::fast_weights::tests::test_fast_weight_creation ... ok
|
|
380
|
+
test arch::fast_weights::tests::test_fast_weight_forward ... ok
|
|
381
|
+
test arch::fast_weights::tests::test_fast_weight_introspection ... ok
|
|
382
|
+
test arch::fast_weights::tests::test_fast_weight_memory_persists ... ok
|
|
383
|
+
test arch::synapse_model::tests::test_model_creation ... ok
|
|
384
|
+
test arch::synapse_model::tests::test_param_counting ... ok
|
|
385
|
+
test arch::synapse_model::tests::test_model_forward ... ok
|
|
386
|
+
test arch::synapse_model::tests::test_model_introspection ... ok
|
|
387
|
+
test arch::synapse_model::tests::test_model_summary ... ok
|
|
388
|
+
test arch::synapse_model::tests::test_model_reset ... ok
|
|
389
|
+
test result: ok. 65 passed; 0 failed; 0 ignored
|
|
358
390
|
```
|
|
359
391
|
|
|
360
392
|
---
|
|
@@ -450,7 +482,7 @@ This thing is early. There's a lot to build and a lot to break.
|
|
|
450
482
|
git clone https://github.com/Djtony707/titan-synapse
|
|
451
483
|
cd titan-synapse
|
|
452
484
|
cargo build
|
|
453
|
-
cargo test #
|
|
485
|
+
cargo test # 65/65 should pass
|
|
454
486
|
|
|
455
487
|
# Run with debug logging
|
|
456
488
|
RUST_LOG=debug cargo run -- serve
|
|
@@ -472,7 +504,7 @@ RUST_LOG=debug cargo run -- serve
|
|
|
472
504
|
- [x] Token counting in API responses (accurate usage stats)
|
|
473
505
|
- [x] Hebbian routing persistence (SQLite-backed pathway learning)
|
|
474
506
|
- [x] .synapse format packer/unpacker with bundled models + adapters
|
|
475
|
-
- [x] CUDA-accelerated inference (
|
|
507
|
+
- [x] CUDA-accelerated inference (106.3 tok/s on RTX 5090, 11.2ms TTFT, 6.43 GB VRAM)
|
|
476
508
|
- [x] Parallel swarm execution (specialists run concurrently, not sequentially)
|
|
477
509
|
- [x] Metacognitive confidence scoring (system tracks what it knows)
|
|
478
510
|
- [x] Smart model selection (prefers larger models when available)
|
|
@@ -481,7 +513,7 @@ RUST_LOG=debug cargo run -- serve
|
|
|
481
513
|
- [x] Real-time knowledge extraction from conversations
|
|
482
514
|
- [x] Hallucination detection (cross-reference against knowledge graph)
|
|
483
515
|
- [x] User feedback preference learning (DPO pair collection)
|
|
484
|
-
- [x] Standardized evaluation (MMLU
|
|
516
|
+
- [x] Standardized evaluation (MMLU 62.6%, GSM8K 18.9% — full datasets on RTX 5090, 15,361 questions)
|
|
485
517
|
- [x] Cloud fallback with auto-learning (DPO pairs from cloud responses)
|
|
486
518
|
- [x] Specialist auto-spawning (system creates new specialists from failure patterns)
|
|
487
519
|
- [x] Web dashboard (chat UI at localhost:6900, stats + metacognition panels)
|
|
@@ -489,11 +521,15 @@ RUST_LOG=debug cargo run -- serve
|
|
|
489
521
|
- [x] Public dataset training pipeline (OpenWebMath, The Stack, SlimPajama, etc.)
|
|
490
522
|
- [x] Speculative decoding scaffold (draft + verify architecture)
|
|
491
523
|
- [x] LoRA adapter training + hot-swap during inference
|
|
524
|
+
- [x] Specialist model merge (TIES merging — 4 adapters into Synapse-3B)
|
|
525
|
+
- [x] Synapse Architecture: Mamba router + xLSTM + Sparse MoE + Fast Weights (28 tests)
|
|
526
|
+
- [x] Full model introspection API (no black box — see every routing decision)
|
|
527
|
+
- [x] Synapse-3B published on [HuggingFace](https://huggingface.co/djtony707/synapse-3b)
|
|
492
528
|
- [ ] Full speculative decoding (shared KV cache state)
|
|
493
529
|
- [ ] Continuous batching across specialists
|
|
494
530
|
- [ ] Doc-to-LoRA knowledge crystallization
|
|
495
531
|
- [ ] Distributed swarm across multiple machines
|
|
496
|
-
- [ ]
|
|
532
|
+
- [ ] Train Synapse Architecture from scratch on RTX 5090
|
|
497
533
|
|
|
498
534
|
---
|
|
499
535
|
|
package/package.json
CHANGED