Neuromorphic computing

From j4flmao/agent-skills · View interactive version

Neuromorphic computing is an AI agent skill from the GitHub repository j4flmao/agent-skills. Use this skill when the user says 'neuromorphic', 'spiking neural network', 'SNN', 'LIF neuron', 'Loihi', 'SpiNNaker', 'event camera', 'surrogate gradient', 'snnTorch', 'Lava framework', 'memristor in-memory computing'. Explains event-driven spiking computation, neuron models, training methods (surr

How to use this skill

Skill file

Neuromorphic Computing

Purpose

Neuromorphic systems compute with sparse, asynchronous spikes and keep state (membrane potentials, synaptic weights) close to where it is used, aiming at very low energy for always-on sensing and temporal processing. They are a research and niche-deployment area: promising for event-camera vision, keyword spotting, and low-power control, but tooling is immature and accuracy on standard benchmarks usually trails conventional deep networks. This skill sets realistic expectations and gives working entry points.

Agent Protocol

Trigger

"spiking neural network", "SNN", "LIF", "neuromorphic chip", "Loihi", "SpiNNaker", "event camera", "DVS", "surrogate gradient", "snnTorch", "Lava", "memristor crossbar".

Input Context

Output Artifact

Feasibility assessment, encoding and neuron model choice, training approach, framework/hardware plan, and comparison metrics.

Response Format

Task: {x}  Data: {events|frames|audio}  Constraint: {power/latency}
Encoding: {rate|latency/temporal|direct event input}
Neuron: {LIF (beta=...)}  Training: {surrogate gradient BPTT|ANN-to-SNN conversion}
Framework: {snnTorch|Norse|SpikingJelly|Lava|Brian2/NEST (neuroscience)}
Target: {GPU simulation|Loihi 2|SpiNNaker 2|other}
Compare: accuracy, spikes/inference, latency, measured energy vs ANN baseline

Completion Criteria

Concepts

Training Approaches

| Method | Idea | Pros | Cons |

|---|---|---|---|

| Surrogate gradient + BPTT | Replace the non-differentiable spike step with a smooth surrogate in the backward pass | Best accuracy for direct training; low latency possible | Memory grows with timesteps |

| ANN-to-SNN conversion | Train ReLU ANN, map activations to firing rates | Reuses ANN tooling | Needs many timesteps; latency |

| Local plasticity (STDP) | Unsupervised, biologically inspired | On-chip learning | Lower accuracy on benchmarks |

snnTorch Example

from __future__ import annotations

import torch
import torch.nn as nn
import snntorch as snn
from snntorch import surrogate


class SpikingMLP(nn.Module):
    def __init__(self, n_in: int, n_hidden: int, n_out: int, beta: float = 0.9) -> None:
        super().__init__()
        grad = surrogate.fast_sigmoid(slope=25)
        self.fc1 = nn.Linear(n_in, n_hidden)
        self.lif1 = snn.Leaky(beta=beta, spike_grad=grad)
        self.fc2 = nn.Linear(n_hidden, n_out)
        self.lif2 = snn.Leaky(beta=beta, spike_grad=grad)

    def forward(self, x_seq: torch.Tensor) -> torch.Tensor:
        """x_seq: [time, batch, features] (spikes or currents). Returns output spikes [time, batch, out]."""
        mem1, mem2 = self.lif1.init_leaky(), self.lif2.init_leaky()
        out = []
        for x in x_seq:
            spk1, mem1 = self.lif1(self.fc1(x), mem1)
            spk2, mem2 = self.lif2(self.fc2(spk1), mem2)
            out.append(spk2)
        return torch.stack(out)

# Rate-coded classification: predicted class = argmax of spike counts over time.
# loss = snntorch.functional.ce_rate_loss()(spk_out, targets)

Device selection follows the usual rule (CUDA → MPS → CPU); simulation cost scales with timesteps × network size.

Hardware Landscape

| Platform | Notes |

|---|---|

| Intel Loihi 2 | Research chip (2021); programmable neurons; Lava open-source framework; large systems such as Hala Point (2024) |

| SpiNNaker / SpiNNaker 2 | Many ARM cores with spike-routing fabric; large-scale neural simulation |

| IBM TrueNorth (2014) | Early digital neuromorphic chip; NorthPole (2023) is a related low-power inference chip but not spiking |

| Commercial edge devices | e.g. BrainChip Akida, SynSense chips for low-power sensing |

| Event cameras (DVS) | Sensors emitting per-pixel brightness-change events; natural SNN input |

Availability and SDKs change; verify current access programs before planning.

When to Prototype

Otherwise, a quantized conventional network on an NPU/MCU is usually the pragmatic choice.

Anti-Patterns

Checklist

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.