Skip to main content

🧠 Spikeling

A neuromorphic domain-specific language and runtime for spiking neural networks, by Gavin Branaa. You describe a network of spiking neurons and synapses in a compact .spk file, and run that one description on any of four backends:

  • an interactive Python runtime (development + STDP learning),
  • generated C (embedded / production),
  • generated Verilog (FPGA / hardware simulation), and
  • GDScript (give a Godot game a live spiking "mind").

One language, four targets.


Quick start

cd core
python -m core                     # run the default example, interactively
python -m core path/to/network.spk # run your own .spk network

Full DSL reference, runtime details, and the C-compilation path are in core/README.md.

The .spk language in 30 seconds

neuron LeftMic  threshold=110 leak=5 type=LIF
neuron RightMic threshold=110 leak=5 type=LIF
neuron Motor    threshold=80  leak=3 type=LIF

connect LeftMic  -> Motor weight=0.8
connect RightMic -> Motor weight=0.8

action Motor -> [MOTOR_FIRE]

refractory=400ms
learn=STDP rate=0.01
Directive Meaning
neuron <name> threshold=<n> leak=<n> [type=LIF] define a neuron
connect <src> -> <dst> weight=<w> weighted synapse
action <neuron> -> [<COMMAND>] map a spike to a named command
refractory=<n>ms global refractory period
learn=STDP rate=<r> enable spike-timing-dependent plasticity

(The GDScript backend uses a compact variant — synapse SRC -> DST weight=N — documented in godot-runtime/.)

Neuron types

Type What it is
LIF Leaky integrate-and-fire — fast, standard
Izhikevich Cortical model — bursting, adaptation
AdEx Adaptive exponential — realism/speed balance
Resonator Damped oscillator — responds only to input near its own frequency (a frequency-domain primitive). See resonator-prototype/

Repository map

Folder What it is Status
core/ The canonical Python package: compiler, runtime, encoder, stdlib, examples. Start here. Active — source of truth
resonator-prototype/ The Resonator neuron type + benchmarks vs Goertzel/FFT Active
godot-runtime/ GDScript backend — run a .spk brain live inside Godot Active
godot-plugin/ Godot editor addon wrapping the brain Active
sdk-verilog/ C + Verilog hardware backend, with testbench Active
parallel-audio/ Real-time microphone/audio input engine (C, miniaudio + FFT) Active, newest
benchmarks/ Performance studies (dormant-vs-polling, gated resonators) Active
fps-game/ An FPS whose enemy AI is driven by Spikeling brains Complete
ai-apps/ Ollama/RAG assistant apps built around Spikeling Active
research/ Stochastic-resonance experiments (does noise help inference?) Exploratory
legacy-versions/ Superseded earlier scripts Reference only
build-artifacts/ Compiled binaries (generated; excluded from git) Generated

Not included here: a separate, unrelated project is kept out of this repository via .gitignore.

Agent orchestration as an SNN

An experimental line of work tests whether a spiking neural network can serve as the control layer for a multi-agent pipeline — routing tasks, managing concurrency, and arbitrating conflicts through spike-based inhibition rather than classical scheduling logic.

File What it does What was verified
core/examples/agent_brain.spk SNN definition for agent-routing and winner-take-all inhibition Routing and lateral inhibition fire correctly in the Python runtime
spiking_orchestrator.py Drives the agent pipeline from spike events Integrates with the runtime; event dispatch works end-to-end
spiking_scheduler.py Maps spike activity to agent-slot concurrency scheduling Mechanism works; falsified as a differentiator — produces identical assignments to classical greedy graph coloring
agent_runner.py Executes individual agents under scheduler control Runs agents correctly within the allocated slots
benchmark_scheduler.py Compares SNN scheduler against greedy coloring across workloads Confirms parity; no throughput advantage found
test_soft_conflicts.py Tests a ternary consensus gate for soft (probabilistic) conflicts Shows a small, real accuracy win under high conflict load, at substantial added complexity
test_incremental_scheduling.py Tests online incremental task arrival against classical online coloring Exact tie — no advantage from the SNN path on incremental arrival

The honest summary: the SNN routing and inhibition primitives work, but the scheduling and arbitration results did not beat well-known classical baselines.


License

MIT (source code). See LICENSE.

Release files for spikeling 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spikeling 1.0.2
File Size Uploaded
spikeling-1.0.2.tar.gz 80.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spikeling 1.0.2
File Interpreter ABI Platform
spikeling-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 171.9 kB

Release files / spikeling-1.0.2.tar.gz

Download URL spikeling-1.0.2.tar.gz
Size 80.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d90383be77b7b4dc0f40ad7858ff34a03df802ef29e72f15209fb2e7f913dff2
BLAKE2b-256 checksum
How to use checksums
cad7a2df8eba09abb6b7e88cd5f36aa722898920b0132dbd5f8317406369bb8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Release files / spikeling-1.0.2-py3-none-any.whl

Download URL spikeling-1.0.2-py3-none-any.whl
Size 91.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
12e6da557cc3b6b920d12fbc6b367087656dfc4b473fb0e2214509b79a783af7
BLAKE2b-256 checksum
How to use checksums
2c02809e4a13a3fcdb44f72c4520bdd9ec9cdf3a509d9aefb3487f548300774e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page