Skip to content

Repository files navigation

GoldWorm Architecture Overview

GoldWorm Neural Visualization

GoldWorm — 302-Neuron Dual-Stream Cognitive Engine

A full-stack transparent cognitive substrate at 1/100,000th the parameter count of an LLM. Structural immunity to catastrophic forgetting. Every synapse inspectable, every claim measured.

MIT License · Rust 2024 · 132 tests · 9 dependencies · CPU-only · https://uniency.com

Why GoldWorm

GoldWorm is built on three non-negotiable principles:

  1. Biological Fidelity — The routing substrate is the experimentally mapped C. elegans connectome (White et al., 1986). Every synapse respects the real topology: pharyngeal 0–19, sensory 20–91, interneurons 92–168, command hubs 99–102 (AVAL/AVAR/AVBL/AVBR), motor 169–301. No de novo synaptogenesis — Hebbian plasticity only strengthens or weakens existing synapses. 95.73% structural zeros are preserved under training; the 302×302 connectivity matrix stays sparse.

  2. Dual-Stream Separation — Action (sparse, post-entmax, ~1–2 active neurons) is physically separated from learning (dense, pre-entmax, >50% non-zero). Gate tests prove dense activation dominates sparse, and EchoReservoir echo fidelity is below 1e-5. The same activation vector is never used for both inference and gradient computation — eliminating the collapse that plagues end-to-end trained networks.

  3. Zero-Trust Engineering — Panic-free public API (Result<T, CoreError>, no unwrap outside tests), OOM-safe pre-allocated buffers, bounded generation (≤15 tokens, 64-state reservoir), deterministic (seeded fastrand, seed 42), 9 runtime dependencies (no tokio/axum/reqwest/chrono). Optional CUDA via candle-core feature flag.

Architecture Overview

token ──► 128-D manifold coordinate
              │
              ▼
      302-D input projection
              │
              ▼
   ┌─────────────────────────────┐
   │  C. elegans synaptic layer    │
   │  302×302, sparse, clamped      │
   └──────────┬──────────────────┘
              │
      ┌───────┴───────┐
      ▼               ▼
  SPARSE ACTION    DENSE LEARNING
  (post-entmax)    (pre-entmax)
  ~1-2 neurons     >50% non-zero
      │               │
      ▼               ▼
  Boltzmann       EchoReservoir
  decode          Hebbian W_assoc

The 128-D token manifold uses Modified Gram-Schmidt orthogonalization, a golden partition (MAJOR=79 / RESIDUAL=49 / OVERLAP=5), non-commutative spinor fusion (Clifford wedge-phase), char n-gram fallback embeddings, and optional Random Indexing semantic embeddings. The 302×128 projection matrix is the only learned component. GoldWorm uses α-entmax (default α=2.0) instead of softmax — a generalization interpolating between softmax and sparsemax. The Quilez Bridge smooth-k parameter k anneals between creativity (dense, k→0) and determinism (sparse, k→∞). Boltzmann decode computes energy as −cosine against 302-D vocab footprints, applies an anti-repetition penalty (0.3 similarity reduction, exponential distance decay), clamps temperature to [0.01, 5.0], and caps generation at 15 tokens.

Honest Current State

GoldWorm is a research-grade engine — not a production product. The committed benchmark (benchmark_results.txt, 2026-06-28, temp 0.05) measures golden-query accuracy at 1/10: the decoding pipeline works (projection, routing, Boltzmann decode all functional), but the projection matrix is under-differentiated (std 0.000646). Synaptic mean activation 0.0305, Boltzmann audit entropy 2.9956, entropy ratio 1.0, contrastive mean distance 0.975. This root cause is mapped in docs/BENCHMARKS.md; the target is ≥5/10 golden queries. All numbers are committed artifacts — no marketing approximations. Deep dives: docs/ARCHITECTURE.md · docs/BENCHMARKS.md · docs/ROADMAP.md · docs/SECURITY.md.

Quick Start

Prerequisites

  • Rust 1.85+ (rustup update)
  • Clone: git clone https://github.com/unicornd47-afk/GoldWorm.git
  • Vocabulary/embedding fixtures are optional — tests skip gracefully without them

Run the test suite

cargo test

132 tests across the suite. All pass on a single CPU core.

Use the library

use goldworm::worm_brain::WormBrain;
use goldworm::geometry::token_to_coord;

let brain = WormBrain::new_baseline();
let coord = token_to_coord("hello");
let route = brain.route_signal(&coord);
println!("Top active: {:?}", route.top_active(10));

Swarm orchestrator

cargo run --bin swarm_orchestrator -- --once

Scans git diff, benchmarks, audits, and tests on an interval; emits structured UpgradeSignals to a local JSONL queue and applies verified patches. Research tooling — not a production service.

Demo HTML files

Double-click index.html (connectome visualizer) or device-inventory-demo.html — no server required.

Technical Specifications

Property Value
Neurons 302
Manifold dimension 128-D
Projection matrix 302×128
Synapses 302×302 sparse, clamped [0,1]
Reservoir states 64
Association matrix 302×302 symmetric, clamped [-1,1]
Max response tokens 15
Synapse weight range [0, 1]
Association weight range [-1, 1]
Temperature clamp [0.01, 5.0]
Rust edition 2024
MSRV 1.85
Checkpoint size 384,320 bytes (safetensors)
Runtime dependencies 9 (no tokio/axum/reqwest/chrono)
Structural zeros preserved 95.73%
CUDA support optional via candle-core feature
Deterministic seed 42 (fastrand)
Hebbian learning rate adaptive, bounded [-0.01, 0.01]
α-entmax default α=2.0 (softmax ↔ sparsemax interpolation)
EchoReservoir capacity 64 states

Module Map

Module Responsibility
geometry 128-D manifold construction, token→coordinate mapping, golden partition (MAJOR=79/RESIDUAL=49/OVERLAP=5), non-commutative spinor fusion (Clifford algebra wedge-phase), fallback char n-gram embeddings
bridge Token/logit projection via RPITIT batch traits (BatchProjector, TokenEncoder): affine map logits = W·coord + b from manifold coordinates into arbitrary vocabulary spaces; loads lm_head safetensors; zero-Box static dispatch
worm_brain Core routing logic, WormBrain::route_signal method, sparse/dense action selection, α-entmax gate, Quilez smooth-k annealing; Boltzmann energy decode (decode_token_energy, VocabFootprints) + Q16.16 rational mode (RationalWormBrain / convert_weights_to_rational)
hippocampus EchoReservoir ring buffer (64-state capacity), Hebbian association matrix W_assoc (302×302 symmetric, clamped [-1,1]), echo bias computation
observation ANSI dashboard module providing real-time activation topography (19×16 heatmap), synaptic weight visualization, reservoir state inspection
storage Safetensors-based checkpoint I/O, atomic writes, versioned serialization, 384,320-byte footprint
criticality Quilez smooth-k annealing between creativity (k→0, dense) and determinism (k→∞, sparse): CriticalityController + CriticalityDashboard (σ, creativity/determinism ratios, branching ratio)
training Hebbian plasticity engine with Maxwell damping (stabilization factor), TDA-driven monitor_and_intervene (β₀ noise injection, β₁ contrastive unlearning), optional dendritic path (placeholder)
tda Persistent homology computation, β₀ (connected components) and β₁ (loops) Betti numbers, persistence diagrams, topological feature tracking
memory SynapticEchoBuffer (decaying echo injection), trajectory vault (log_trajectory JSONL, consolidate_sleep offline Hebbian replay at lr=0.001/sf=0.999, vault.json)
neuron Dendritic tree placeholder for triple-quad packet folding: Packet (threshold + basal_w), 38 packets, quad_routing stubs — documented research-build boundary
swarm_orchestrator Automated improvement system: scans git diff, benchmark_results.txt, audit logs, test suite; emits structured UpgradeSignals to JSONL queue; applies verified patches via Rust stdlib

Roadmap

  • Projection calibration gate — fix the under-differentiated projection matrix; target ≥5/10 golden queries
  • ARC-AGI-3 participation — route ARC grid observations as manifold coordinates, EchoReservoir pattern-completion hypotheses, TDA β₁ as wrong-hypothesis detector; first gate: beat random baseline on public sim games
  • Sub-1 MB agent runtime — dendritic quad-routing for connection pruning, stripped deployment targeting <1024 KB

Full roadmap: docs/ROADMAP.md.

The Science Behind GoldWorm

Why C. elegans?

The C. elegans connectome is the only completely mapped nervous system — 302 neurons, ~7,000 synapses, fully catalogued by electron microscopy (White et al., 1986). Every wiring diagram is public. This makes GoldWorm the most inspectable neural substrate available: no black-box weights, no billion-parameter mysteries. The 302×302 synaptic matrix is a real biological blueprint, not an arbitrary shape.

Why Dual-Stream?

The brain separates action (sparse motor output) from learning (dense sensory prediction). If a network learns from its own sparse outputs, the gradient collapses — the network forgets what it just learned. GoldWorm's dual-stream design keeps the dense signal for Hebbian updates and the sparse signal for action selection, preventing the self-reinforcing collapse. EchoReservoir fidelity is below 1e-5, confirming the echo does not distort the dense state.

Why Hebbian?

"Neurons that fire together, wire together." Hebbian plasticity is local, online, and O(n) — no backpropagation, no gradient descent, no external optimizer. Combined with the EchoReservoir's associative echo bias, it creates emergent memory without training loops, perfect for a single-CPU-core, zero-trust engine. The symmetric W_assoc clamped to [-1,1] ensures stability without regularization hacks.

Position

GoldWorm is a bet that the next tier of AI deployment — edge devices, embedded systems, regulated environments where every inference must be auditable — cannot be served by billion-parameter black boxes. A 384 KB checkpoint on a single CPU core is a footprint class transformers cannot reach. Full-stack interpretability (every synapse, every association, every activation inspectable at runtime) converts AI governance from a promise into an observable property. The measured-evidence brand — honest baselines, committed artifacts, root-caused failures — is the moat: trust compounds.

License

MIT — See LICENSE for details.


"GoldWorm: not a black box. Not a billion parameters. Just 302 neurons, doing what 302 neurons do."

About

302-neuron C. elegans cognitive engine in Rust: dual-stream Hebbian associative memory, transparent connectome routing — zero black-box weights

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages