Back to all projects
InteractiveComputational Neuroscience

Pavlov's Dog

A spiking neural network built in Rust and WebAssembly demonstrating classical conditioning. Watch connections form through Hebbian learning and weaken through extinction.

Loading neural network...

How It Works

🔔 Bell (Neutral Stimulus)

Initially, ringing the bell has no effect on the dog. The connection weight from Bell → Salivate is 0.

🍖 Food (Unconditioned Stimulus)

Food always triggers salivation. This is a hardwired, instinctual response with a fixed strong weight.

🎓 Training (Classical Conditioning)

Presenting bell + food together strengthens the Bell → Salivate connection through Hebbian learning ("neurons that fire together, wire together").

📉 Extinction

After training, ringing the bell without food causes the weight to gradually decrease. The dog "unlearns" the association.

Technical Details

  • Leaky Integrate-and-Fire (LIF) Neurons: Each neuron accumulates input current, applies a decay factor (leak), and fires when voltage exceeds a threshold.
  • Hebbian Learning: When bell and food neurons spike together, the synaptic weight increases by 0.1 (capped at 1.5).
  • Extinction: When bell spikes without food, the weight decreases by 0.15 (floored at 0).
  • Rust + WebAssembly: The neural network runs in compiled Rust for performance, exposed to JavaScript via wasm-bindgen.
✓ FinishedView source →