A personal local-AI router, persistent memory store, and web UI built for a single 24GB GPU (NVIDIA RTX 3090) paired with a Gen4 NVMe drive on Ubuntu.
Instead of manually loading and unloading GGUF files every time I switch from coding to SQL or reading a long log, synapse-mind sits in front of llama-server (router mode) on http://127.0.0.1:18445 and handles three practical jobs:
- Keeps
bge-m3(1024-dimembeddings) loaded in CPU RAM (n-gpu-layers = 0) alongside whichever 7B-32B model is active in VRAM, so storing and searching past chat notes never forcesllama-serverto unload the main GPU model. - Routes incoming prompts across 13 local GGUF presets, and when a prompt looks unfamiliar compared to past episodes in SQLite, queries two models (for example
DeepSeek-R1-Distill-Qwen-32B+Qwen2.5-Coder-32B-Instruct) before combining the answer. - Logs episodes, feedback scores, and pairwise model routing weights in a local SQLite WAL database (
synapse_forge.db).
flowchart TD
User["Web UI (http://127.0.0.1:18445)"] --> Server["Async Web Server (studio_server.py)"]
Server --> Partner["Router & Session Logic (cognitive_partner.py)"]
Partner --> Core["Weight Matrix & Similarity Lookup (cognitive_core.py)"]
Partner --> DB["SQLite WAL Store (synapse_forge.db)"]
Partner --> Embed["CPU BGE-M3 Embeddings (n-gpu-layers=0, ~650 MB RAM)"]
Partner --> Router["llama-server Router (Port 18434 -> 18436)"]
subgraph Fleet["Local GGUF Presets (NVMe Direct I/O -> 24GB VRAM)"]
M0["Qwen3.8-27B-UD (General / Architecture)"]
M1["Qwen3.8-27B-Uncensored (Security)"]
M2["Qwen2.5-Coder-32B (Coding)"]
M3["DeepSeek-R1-32B (Reasoning / Math)"]
M4["Qwen3-30B-A3B MoE (~70 t/s Fast Chat)"]
M5["Qwen2.5-14B-1M (Long Context)"]
M6["Qwen2.5-VL-7B (Vision)"]
M7["sqlcoder-7b-2 (SQL)"]
M8["Hermes-3-8B (JSON / Tool Calls)"]
M9["gemma-2-27b-it (Writing)"]
M10["Qwen2.5-3B (~155 t/s Quick Classifier)"]
end
Router --> Fleet
Running llama-server with --models-max 2 --load-mode dio and pinning [bge-m3] to CPU (n-gpu-layers = 0 in presets/fleet_presets.example.ini) solves the most annoying bottleneck on a single 24GB card:
bge-m3stays resident in normal system RAM (~650 MB) and computes1024-dimembeddings in under25 ms.- All 24 GB of GDDR6X VRAM stays free for a 27B/30B/32B model without swapping models in and out just to embed a search query.
--load-mode dio(NVMe Direct I/O) bypasses Linux page-cache thrashing and keeps cold 18.5 GB 32B model switches down around8.8 secondson a Samsung 990 PRO.
After each turn or multi-model run, CognitiveCore.compute_oja_update in cognitive_core.py updates a
where
Incoming prompts are compared against stored episode embeddings in SQLite using cosine distance:
Routine prompts go straight to one preset; when CognitivePartner escalates to a two-model pass (such as pairing DeepSeek-R1-Distill-Qwen-32B with Qwen2.5-Coder-32B-Instruct) and merges their outputs, alongside log-sum-exp Hopfield-style associative retrieval over past notes.
| Index | Model ID | What I use it for | Typical speed (RTX 3090) |
|---|---|---|---|
0 |
Qwen3.8-27B-UD-Q4_K_M |
General design & planning | ~42 t/s |
1 |
Qwen3.8-27B-Uncensored |
Security & red-team testing | ~42 t/s |
2 |
Qwen2.5-Coder-32B-Instruct |
Main 32B coding model | ~36 t/s |
3 |
DeepSeek-R1-Distill-Qwen-32B |
Step-by-step logic, debugging & math | ~35 t/s |
4 |
Qwen2.5-Coder-14B-Instruct |
Quicker 14B code edits | ~68 t/s |
5 |
DeepSeek-R1-Distill-Qwen-14B |
Faster reasoning checks | ~66 t/s |
6 |
Qwen2.5-VL-7B-Instruct |
Screenshots, OCR & UI inspection | ~95 t/s |
7 |
sqlcoder-7b-2 |
SQL queries & schema drafts | ~105 t/s |
8 |
Qwen2.5-Coder-14B-abliterated |
Binary / exploit auditing | ~68 t/s |
9 |
Hermes-3-Llama-3.1-8B |
Structured JSON & tool calling | ~98 t/s |
10 |
gemma-2-27b-it |
Long-form writing & docs | ~40 t/s |
11 |
bge-m3 |
CPU-pinned 1024-dim embeddings | <25ms / embed |
12 |
Qwen3-30B-A3B |
Fast 30B MoE (3B active) everyday chat | ~70.6 t/s |
+ |
Qwen2.5-14B-Instruct-1M |
Long-context log & repo reader (up to 128K) | ~64 t/s |
+ |
Qwen2.5-3B-Instruct-abliterated |
Fast prompt classifier | ~155.1 t/s |
pip install -r requirements.txtEdit presets/fleet_presets.example.ini to point at your own .gguf folder, then run:
llama-server \
--models-preset presets/fleet_presets.example.ini \
--models-max 2 \
--load-mode dio \
--port 18434python studio_server.pyOpen http://127.0.0.1:18445/ in your browser.
| Variable | Default | Description |
|---|---|---|
SYNAPSE_PROXY_URL |
http://127.0.0.1:18434/v1 |
OpenAI-compatible local router URL |
SYNAPSE_API_KEY |
local-key |
Bearer token if your local router checks one |
SYNAPSE_DB_PATH |
./synapse_forge.db |
Path to the SQLite WAL database |
JARVIS_MEMORY_DB |
../jarvis/memory.db |
Optional path to a shared external memory.db |
pytest tests/ -qRuns the test suite covering the Oja/Hopfield/TD(
This is an experimental local-AI project built for my own RTX 3090 setup, put together with plenty of help from AI coding assistants on the routing math, async aiohttp server boilerplate, web UI, and test suite.
Released under the MIT License.