Henryfud / nema
git clone https://github.com/Henryfud/nema.git
A 302 neuron network on the real C. elegans wiring diagram, with a steering layer for local language models.
+-11
stars, 24h · #62,374
+~-30
stars, 7 days · #62,259
+192
stars, 30 days · #4,049
192
★ total · -14% this week
0
forks · 0 open issues
Star history (as recorded here)
LanguageHTML
LicenseMIT
Created2026-10-06 (17d ago)
Last push2d ago
Watchers0
OwnerUser
GitHub topics
Links
- GitHub: github.com/Henryfud/nema
- Releases · Issues · Hacker News mentions
README excerpt
# WERM **W**iring-**E**ncoded **R**ecurrent **M**odulator A 302 neuron model built on the real wiring diagram of *Caenorhabditis elegans*, with a small steering layer that lets its state nudge a local language model. It runs in a browser tab, in Node, or connected to a language model on your own computer through Ollama or any OpenAI style local server. werm.si · @WERM_si on X The site in `site/` is a long scroll page with a generative pixel worm field, a live connectome globe, the genome drawn to scale from the real sequence, and long form notes. The code in `src/` is the same code the site runs. ## What is real here - **The wiring.** `data/connectome.json` is the adult hermaphrodite network from Cook et al. 2019 (doi:10.1038/s41586-019-1352-7), taken from the OpenWorm Connectome Toolbox. 302 neurons, 3,709 directed chemical connections and 1,105 gap junction pairs. Each connection's weight is the number of electron microscope sections in which the two cells were seen joined, not a synapse count. - **The genome.** `data/gc_windows.json` and `data/gene_windows.json` were measured from the NCBI reference genome (RefSeq GCF_000002985.6, WBcel235) and its gene annotation (WormBase WS298) by scripts in this repo. 100,272,607 bases on six chromosomes, 35.4 percent GC, 19,971 protein coding genes. - **The neuron model.** A rate network with a gate in the style of the liquid time constant networks of Hasani et al. 2021, run on that wiring. The 28 neurons that make and release GABA (Gendrel et al. 2016) are inhibitory. Everything else is excitatory. - **The results.** Measured, with the scripts to rerun them. Summary below, details in `docs/RESULTS.md`. ## What is a design choice - **Synapse signs.** A wiring diagram does not say which synapses excite and which inhibit. The GABA rule above is a simplification, explained in `docs/NEUROTRANSMITTERS.md`. - **The parameters.** Four were picked by `scripts/sweep.mjs` over 1,470 settings, using a rule fixed before the results were seen. It is a tuned model, not a fit to recordings. - **The steering.** The mapping from worm state to temperature, top_p and the rest is easy to see and easy to change. Neuroscience does not dictate it. ## Results | question | answer | | --- | --- | | Does tail touch push the network forward? | Yes, strongly. It beats 100 out of 100 random pokes of the same size. | | Does nose touch push it backward? | Yes. It beats 100 out of 100 random pokes. | | Does head touch push it backward? | Only slightly. The wiring shows why: the head touch cells send most of their chemical output to the *forward* command cells. | | Does a noxious stimulus push it backward? | No better than a random poke. | | Does the real wiring matter? | For the head versus tail difference, yes. Each of 100 shuffled copies (same number of connections per neuron) got its own parameter sweep, and only 2 matched the real wiring. Of 100 random networks, 5 did. | | Is the real wiring a better general signal processor? | No. O