I built a Continuous Attractor Network with 3 motor neurons which...

@hive_echo
echo.hive@hive_echo
31 views Oct 26, 2025 ~1 min read
Advertisement
1
I built a Continuous Attractor Network with 3 motor neurons which learn to guide the mice towards food using Reward‑modulated Hebbian plasticity

No backpropagation and no SGD.

In this case at first, the networked learned to circle around the food 😯

Source code is open source. link in comment

36 neurons in the CAN detect where the food is, each neuron in this network connect to every motor neuron.

At first the connections are random and weak and they get stronger as mice approaches and reaches food. network does this by keeping track of which neurons fired together to achieve this and strengthen those connections

If you find this interesting check out my Spiking neural networks project. I will put a link to that in comment as well
0:49
@hive_echo
echo.hive@hive_echo
Spiking Neural Network from scratch achieves 8% accuracy. no backpropagation or SGD

I created a genetic hyper parameter optimizer and it now, on average, can get 8% accuracy which is ~3% above chance

Link to source code with a detailed video and markdown explanations in comment

it also usually starts lower than 5% and slowly improves then eventually can start dipping below 5%, all of which leads me to believe there is glimmers of learning taking place. sometims it is stabel around 7-8-9% for a long time

there is no backpropagation or SGD. it learns via STDP (spike timing dependent plasticity) and a reward mechanism

each example is presented n many times (500 in this case) which produces spike train which leads to eligibility list, at the end of a turn based on if the answer was correct or not we adjust the weights using the reward as a multiplier

spike timing keeps track of the sequence of neuron firings and which ones were more likely to have lead to the correct answer

let me know what you think
2
Source code for Continuous attractor network navigation:
patreon.com/posts/continuo…
3
Here is another biology inspired project: Spiking neural network learns to do addition:
patreon.com/posts/spiking-…
4
Here is a more advanced version with obstacle avoidance:

@hive_echo
echo.hive@hive_echo
Continuous attractor network and boundary vector cells(whiskers) combined with 3 motor neurons learn to navigate obstacles and go toward food

No backpropagation. rewards modulated learning with eligibility traces

Link to source code in comment.
5
here is an improved version of this with multiple agents:

@hive_echo
echo.hive@hive_echo
Improved self-learning agents playground

added some more biologically inspired improvements. will list all features in detail below the summary.

link to source code in comment

Each agent senses the world through a ring of “direction” neurons and a ring of boundary-vector cells that fire when walls are near.

Fast reflexes kick in immediatel, bouncing off corners and peeling away from sudden frontal contact, while a slower “edge pressure” builds if an agent clings to walls, nudging it back toward open space.

Above these instinctive layers sits a dopamine-style reinforcement learner with eligibility traces that link recent actions to delayed outcomes, and a softmax action selector that keeps behavior exploratory instead of deterministic.

here are bilogically inspired features:

1- Sensory Rings: Encode target direction (food for prey, prey for predator)
Continuous Attractor Networks (head-direction cells)

2- Boundary Vector Cells: Detect walls/obstacles in 36 directions
Entorhinal boundary vector cells

3- Motor Network + Eligibility Traces: Learn turn policies from rewards/punishments
Three-factor Hebbian learning with synaptic traces

4- Dopaminergic Shaping: Rewards for progress, punishments for setbacks
Reward-modulated plasticity, dopamine RPE

5- Hard Reflex Layer: Instant wall avoidance, corner escape
Brainstem/superior colliculus reflex loops

6- Edge Pressure Drive: Builds while wall-hugging, decays in open space
Thigmotaxis habituation, homeostatic motivation

7- Softmax Action Selection:Noisy competition (no argmax loops)
Basal ganglia stochastic policy

There is still much to add or to simplify. it is difficult t know which dircdtion to push but it is all a very interesting learning experience
Actions
What You Can Do
  • Export as PDF or Markdown
  • Batch Export to Notion
  • Bookmark & Highlight
  • Screenshot Tweet
Create Free Account

Includes 7-day Premium trial

Advertisement