omega-snn
Biologically-inspired spiking neural network with LIF neurons, STDP learning, and neuromodulation.
Part of the ExoGenesis-Omega cognitive architecture.
Overview
omega-snn provides the neural substrate for the Omega cognitive architecture. Unlike rate-coded neural networks, spiking neural networks (SNNs) use discrete spike events for communication, matching biological neural computation.
Key components:
- Leaky Integrate-and-Fire (LIF) Neurons: Biologically plausible neuron dynamics
- Spike-Timing Dependent Plasticity (STDP): Hebbian learning based on spike timing
- Neuromodulation: Dopamine, norepinephrine, serotonin, acetylcholine
- Short-Term Plasticity: Facilitation and depression
- Population Coding: Sparse distributed representations
Features
- LIF Neurons: Membrane potential, refractory period, adaptive threshold
- Adaptive LIF: Spike-frequency adaptation for realistic dynamics
- STDP Learning: Asymmetric time-window for causal learning
- 4 Neuromodulators: Global modulation of learning and behavior
- Synaptic Dynamics: Facilitation, depression, and saturation
- Spike Trains: Temporal coding and rate coding analysis
- Neural Populations: Excitatory, inhibitory, sensory, motor
Installation
Add this to your Cargo.toml:
[]
= "1.0.0"
Quick Start
use ;
Architecture
┌─────────────────────────────────────────────────────────────┐
│ SPIKING NEURAL NETWORK │
├─────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ NEUROMODULATOR SYSTEM │ │
│ │ Dopamine │ Norepinephrine │ Serotonin │ Acetylcholine│ │
│ └──────────────────────────────────────────────────────┘ │
│ ↓ │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ NEURAL POPULATIONS │ │
│ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │
│ │ │Excitatory│ │Inhibitory│ │ Sensory │ │ Motor │ │ │
│ │ │ Neurons │ │ Neurons │ │ Neurons │ │ Neurons │ │ │
│ │ └─────────┘ └─────────┘ └─────────┘ └─────────┘ │ │
│ └──────────────────────────────────────────────────────┘ │
│ ↓ │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ SYNAPTIC CONNECTIONS │ │
│ │ STDP │ Short-Term Plasticity │ Weights │ │
│ └──────────────────────────────────────────────────────┘ │
│ ↓ │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ SPIKE TRAINS │ │
│ │ Temporal coding │ Rate coding │ │
│ └──────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
LIF Neurons
Leaky Integrate-and-Fire is the workhorse neuron model:
use ;
// Create neuron with custom parameters
let params = LIFParams ;
let mut neuron = new;
// Integrate input current
for t in 0..100
Adaptive LIF
Includes spike-frequency adaptation:
use AdaptiveLIFNeuron;
let mut neuron = new_default;
// With constant input, firing rate decreases due to adaptation
for t in 0..500
STDP Learning
Spike-Timing Dependent Plasticity for causal learning:
use ;
let params = STDPParams ;
let stdp = new;
let mut synapse = new; // Initial weight 0.5
// Pre-before-post: potentiation
let pre_time = 100.0;
let post_time = 110.0;
let dw = stdp.compute_update;
synapse.update_weight;
println!;
// Post-before-pre: depression
let post_time = 200.0;
let pre_time = 210.0;
let dw = stdp.compute_update;
synapse.update_weight;
println!;
Neuromodulation
Global modulation of network dynamics:
use ;
let mut neuromod = new;
// Increase dopamine (reward/motivation)
neuromod.release;
// Get current levels
let da = neuromod.level;
let ne = neuromod.level;
let ser = neuromod.level;
let ach = neuromod.level;
println!;
println!;
println!;
println!;
// Neuromodulators decay over time
neuromod.decay; // 1% decay per step
Modulation Effects
// Dopamine modulates STDP learning rate
let learning_rate = base_rate * ;
// Norepinephrine modulates gain
let gain = base_gain * ;
// Serotonin modulates inhibition
let inhibition = base_inhibition * ;
// Acetylcholine modulates attention
let attention = base_attention * ;
Spike Trains
Temporal representations of neural activity:
use ;
// Create spike train
let mut train = new;
train.add_spike;
train.add_spike;
train.add_spike;
train.add_spike;
// Analysis
let analysis = new;
println!;
println!; // 100ms window
println!;
println!; // Regularity measure
// Inter-spike intervals
for isi in analysis.isis
Neural Populations
Organize neurons into functional groups:
use ;
let mut excitatory = new;
let mut inhibitory = new;
// Connect (E-I balance)
excitatory.connect_to; // E → I
inhibitory.connect_to; // I → E (inhibitory)
// Step simulation
excitatory.step;
inhibitory.step; // Driven by excitatory
// Population activity
let activity = excitatory.activity;
println!;
println!;
println!;
Sparse Coding
Efficient distributed representations:
use SparseCode;
// Create sparse code (10% active)
let code = new;
// Encode input
let input = vec!;
let sparse = code.encode;
println!;
println!;
Configuration
use NetworkConfig;
let config = NetworkConfig ;
let snn = new;
Use Cases
1. Sensory Processing
// Visual input as spike patterns
let visual_input = encode_image_as_spikes?;
// Process through visual hierarchy
let v1_spikes = v1_layer.process?;
let v2_spikes = v2_layer.process?;
let it_spikes = it_layer.process?; // Object recognition
2. Reinforcement Learning with Dopamine
// Reward prediction error modulates learning
if reward > expected_reward else if reward < expected_reward
// STDP learning is enhanced by dopamine
for synapse in active_synapses
3. Working Memory
// Persistent activity through recurrent excitation
let mut wm_circuit = new;
wm_circuit.connect_to; // Recurrent connections
// Activate with input
wm_circuit.inject_current;
// Activity persists after input removed
for t in 0..1000
Integration with Omega
omega-brain (Unified Integration)
└── omega-snn (This crate)
├── LIF neurons
├── STDP learning
├── Neuromodulation
├── Populations
└── Spike trains
Provides substrate for:
├── omega-attention - Neural attention
├── omega-consciousness - Neural correlates
└── omega-hippocampus - Memory circuits
Related Crates
- omega-brain - Unified cognitive architecture
- omega-attention - Attention mechanisms
- omega-hippocampus - Memory circuits
- omega-sleep - Synaptic homeostasis
References
- Gerstner, W., & Kistler, W. M. (2002). "Spiking Neuron Models"
- Bi, G., & Poo, M. (1998). "Synaptic Modifications in Cultured Hippocampal Neurons"
- Dayan, P., & Abbott, L. F. (2001). "Theoretical Neuroscience"
- Izhikevich, E. M. (2007). "Dynamical Systems in Neuroscience"
- Schultz, W. (2007). "Behavioral Dopamine Signals"
License
Licensed under the MIT License. See LICENSE for details.