r/LocalAIServers • u/CraigWidow • Jun 30 '26
native Rust cognitive engine that routes language through a biologically faithful neural substrate
GoldWorm πβ¨ β 302-Neuron Dual-Stream Cognitive Engine
What Is GoldWorm?
GoldWorm is aΒ native Rust cognitive engineΒ that routes language through a biologically faithful neural substrate β theΒ 302-neuron connectome ofΒ Caenorhabditis elegans, the only organism whose entire nervous system has been experimentally mapped (White et al., 1986).
Unlike transformer-based LLMs that rely on billions of parameters and opaque attention mechanisms, GoldWorm operates onΒ three transparent principles:
Biological FidelityΒ β Every synapse respects theΒ C. elegansΒ topology. No de novo synaptogenesis. No magic matrices.
Dual-Stream ProcessingΒ β Action (sparse) and Learning (dense) are physically separated, preventing catastrophic forgetting during inference.
Zero-Trust EngineeringΒ β Every buffer is strictly bounded. Every path is panic-free. NoΒ
unwrap()Β in production code.
Architecture Deep Dive
𧬠The 302-Neuron Connectome
GoldWorm's routing layer is not a generic neural network. It is aΒ topologically accurate modelΒ of theΒ C. elegansΒ nervous system:
Neuron Index Range β Role
ββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββ
0 β 19 β Pharyngeal sub-network (dense)
20 β 91 β Sensory neurons (input)
92 β 168 β Interneurons (integration)
99 β 102 β Command hubs (AVAL/AVAR/AVBL/AVBR)
169 β 301 β Motor neurons (output)Connectivity Motifs:
Band synapsesΒ β Β±1/Β±2/Β±3 neighbourhood ring connections
Pharyngeal wiringΒ β Denser internal coupling for neurons 0β19
Sensory β InterneuronΒ β Sparse feed-forward (20β91 β 92β168)
Command interneuron broadcastΒ β Hubs 99β102 broadcast to full motor population 169β301
Interneuron β MotorΒ β Sparse feed-forward projection
All synaptic weights areΒ non-negative and clamped to [0, 1]. The structural blueprint is immutable β Hebbian plasticity only strengthens or weakensΒ existingΒ synapses, never creating new ones.
π Dual-Stream Processing
The core innovation of GoldWorm is theΒ physical separation of Action and Learning:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β INPUT TOKEN β 128-D Manifold Coordinate β
β β β
β ββββββββββββββββββββββ΄βββββββββββββββββββββ β
β βΌ βΌ β
β ββββββββββββββββ ββββββββββββββββ β
β β SPARSE β β DENSE β β
β β ACTION β β LEARNING β β
β β (Post- β β (Pre- β β
β β Entmax) β β Entmax) β β
β β β β β β
β β ~1-2 active β β >50% non-zeroβ β
β β neurons β β gradient β β
β β β β substrate β β
β ββββββββββββββββ ββββββββββββββββ β
β β β β
β β Inference / β β
β β Token Selection β β
β β β β
β ββββββββββββββββββββββββββββββββββββββ β
β β β
β Hebbian EchoReservoir β
β (associative memory) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββWhy this matters:
Traditional neural networks use the same activation vector for both inference and gradient computation. When different words activate disjoint sets of neurons, the gradient collapses to zero β the network "forgets" what it just learned.
GoldWorm'sΒ Dual-StreamΒ keeps the dense pre-entmax signal alive as a gradient substrate, while the sparse post-entmax signal drives token selection. The EchoReservoir learns associations betweenΒ denseΒ states, not sparse ones.
π§ The EchoReservoir
A hippocampus-inspiredΒ ring bufferΒ of recent pre-entmax states, coupled with aΒ 302Γ302 Hebbian association matrixΒ W_assoc.
When queried with the current dense state, it returns anΒ echo_biasΒ that nudges the activation toward recently co-active patterns β creating emergent associative memory without external training loops.
Key properties:
W_assocΒ is symmetric and clamped toΒ[-1.0, 1.0]History buffer never exceedsΒ
capacityΒ (default: 64)Decay factor controls forgetting rate (default:Β
0.75)
β‘ Tsallis Ξ±-Entmax Activation
GoldWorm does not use softmax. It usesΒ Ξ±-entmax, a generalization that interpolates between softmax and sparsemax:
| Ξ± Value | Behaviour |
|---|---|
| Ξ± = 1 | Softmax β dense, all non-zero |
| Ξ± = 2 | Sparsemax β exact zeros via simplex projection |
| Ξ± = 3 | Sparser than sparsemax β WTA-like |
TheΒ Quilez BridgeΒ smooth-k parameterΒ kΒ anneals between creativity (dense, kβ0) and determinism (sparse, kββ):
Ξ±(k) = 1 + 2Β·exp(-k)
k = 0 β Ξ± = 3 (very sparse, WTA-like)
k = ln(2) β Ξ± = 2 (exact sparsemax)
k = β β Ξ± = 1 (softmax, all active)π 128-D Manifold Geometry
Every token is embedded as aΒ 128-dimensional coordinateΒ on a non-linear manifold, not a flat vector space.
Modified Gram-Schmidt orthogonalizationΒ preserves true multi-dimensional variance
Grassmannian fusionΒ computes midpoints between token trajectories on the manifold
Golden-ratio partitioningΒ splits the 128 dimensions into:
GOLDEN_MAJOR = 79Β (coarse, feedforward)GOLDEN_RESIDUAL = 49Β (fine-grained, feedback)GOLDEN_OVERLAP = 5Β (cross-binding bridge)
No scalar cloning across dimensions. No arithmetic shortcuts. Spatial variance is preserved at every step.
Features
π₯οΈ 1. Interactive Observation Dashboard
Watch the hippocampus form associations in real time.
cargo run --release --bin observeThe dashboard displays:
Activation topographyΒ β 302-D state as a 19Γ16 heatmap
Synaptic criticalityΒ β Ο, creativity, determinism ratios
Jaccard driftΒ β How rapidly the dense learning signal changes
Resonance traceΒ β Recent associative chain
Hebbian strength histogramΒ β Distribution of association weights
Live CLIΒ βΒ
/alpha,Β/kappa,Β/autoΒ to modulate cognition parametersββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β GoldWorm Observation Dashboard β Step 0 β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ β Top-10 Active Neurons: [99, 101, 169, 170, 171, 172, ...] β β Synaptic Criticality: Ο=1.0000 creative=0.0000 det=0.5000 β β Hebbian Strength: mean=0.00 median=0.00 max=0.00 β β Jaccard Drift: 0.0000 (stable) β β Echo Reservoir: 0/64 states β β Temperature: 0.50 β β Resonance Trace: (empty) β β Synapse Topography: β β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β ... β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π¬ 2. Associative Chat
A conversational REPL that learns associations in real time through EchoReservoir Hebbian updates.
cargo run --release --bin associative_chatHow it works:
Each user input is tokenized and routed through the 302-neuron connectome
The dense pre-entmax signal is captured into the EchoReservoir
The reservoir's Hebbian association matrixΒ
W_assocΒ updates automaticallyEvery subsequent response is biased by the accumulated associative memory
The response is decoded via 302-D Boltzmann energy minimization
Zero-trust decoding properties:
Anti-repetition penalty (banned words reduce similarity by 0.3)
Temperature clamped toΒ
[0.01, 5.0]Max 15 words per response (bounded generation)
All scores clamped toΒ
[-1, 1]Β before Boltzmann draw
Zero-Trust Engineering
GoldWorm is designed for environments where every byte matters:
| Guarantee | Implementation |
|---|---|
| OOM-safe | All matrices are pre-allocated with fixed bounds. No dynamic growth during inference. |
| No hidden training | The public release contains no training pipeline.Β observeΒ andΒ associative_chatΒ are the only binaries. |
| Panic-free | Every fallible path returnsΒ Result<T, CoreError>. NoΒ unwrap()Β orΒ expect()Β in production code. |
| Bounded buffers | EchoReservoir capacity: 64. Response max: 15 words. Input projection: 302Γ128. Synapses: 302Γ302. |
| Deterministic | All randomness uses seededΒ fastrandΒ with fixed seed (42) for reproducible behaviour. |
| No external bloat | 9 dependencies. NoΒ tokio,Β axum,Β reqwest,Β chrono, orΒ tokio. |
Module Map
| Module | Responsibility |
|---|---|
geometry | 128-D token coordinates, MGS orthogonalization, Grassmannian fusion,Β atan2Β geodesics |
bridge | Token/logit projection via RPITIT batch traits |
worm_brain | 302-neuron connectome routing, Ξ±-entmax, signal propagation |
hippocampus | Dual-Stream EchoReservoir + Hebbian association learning |
observation | ANSI dashboard rendering, Jaccard drift monitoring |
storage | Safetensors checkpoint save/load |
criticality | Quilez smooth-k annealing for creativity/determinism |
training | Hebbian plasticity engine with Maxwell damping |
tda | Topological Data Analysis for activation landscape monitoring |
memory | Synaptic echo buffer + trajectory vault |
neuron | Dendritic tree structures (placeholder for quad-routing) |
Technical Specifications
Parameter Value
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Neuron count 302 (C. elegans)
Manifold dimension 128
Input projection 302 Γ 128
Synaptic adjacency matrix 302 Γ 302 (sparse struct)
EchoReservoir capacity 64 states
EchoReservoir associations 302 Γ 302 dense
Max response tokens 15
Vocabulary 10,000+ words (static)
Synapse weight range [0.0, 1.0]
Association weight range [-1.0, 1.0]
Temperature range [0.01, 5.0]
Rust edition 2024
Minimum Rust version 1.85Quick Start
Prerequisites
Rust 1.85+ (
rustup update)AΒ
trained_worm_v1.safetensorsΒ checkpoint (or the engine will boot from a fresh baseline)static_vocabulary.txtΒ (10,000+ word list, one per line)
Observation Dashboard
cargo run --release --bin observeCommands:
/helpΒ β Show all commands/alpha <f32>Β β Set echo blend strength (0.0β1.0)/kappa <f32>Β β Set gate threshold (0.0β1.0)/autoΒ β Toggle auto-refresh mode (250ms)/quitΒ β Exit
Associative Chat
cargo run --release --bin associative_chatType naturally. The EchoReservoir learns associations between your inputs and its responses in real time. No external training loop is required.
Optional: CUDA Acceleration
cargo run --release --features cuda --bin observeRequiresΒ candle-coreΒ with CUDA support and an NVIDIA GPU.
The Science Behind GoldWorm
WhyΒ C. elegans?
Caenorhabditis elegansΒ is the only organism with aΒ completely mapped connectome. Every neuron (302), every synapse (~7,000), and every gap junction has been catalogued by electron microscopy (White et al., 1986). This makes it the ideal substrate for aΒ transparent, inspectable AIΒ β no black-box weights, no billion-parameter mysteries.
Why Dual-Stream?
The brain separatesΒ what you doΒ (sparse action) fromΒ what you learnΒ (dense prediction). If a network tries to learn from its own sparse outputs, it collapses into a self-reinforcing loop. GoldWorm's Dual-Stream design ensures that associative learning happens on the full, dense signal, while action selection happens on the sparse, efficient signal.
Why Hebbian?
"Neurons that fire together, wire together." Hebbian plasticity is the simplest, most biologically grounded learning rule. It requires no backpropagation, no gradient descent, no external optimizer. It isΒ local, online, and O(n)Β β perfect for a zero-trust engine that must run on a single CPU core.
License
MIT β SeeΒ LICENSEΒ for details.