spb/artificial-neural-networks-book Public
Artificial Neural Networks — Methods, Equations and Graphical Representations: a complete book, every method with rigorous equations, pseudocode and native TikZ figures.
TeX 100%
1% ============================================================================2% Artificial Neural Networks — Methods, Equations and Graphical3% Representations4% Author : Simon-Pierre Boucher — contact@spboucher.ai5% Chapter 12 : Biologically Inspired Networks (chapters/12-bio-inspired.tex)6% ============================================================================78\chapter{Biologically Inspired Networks: Spiking Neurons, Self-Organizing9 Maps and Reservoir Computing}\label{chap:bio}1011Every architecture examined so far shares one commitment: a differentiable12map from inputs to outputs, trained by gradient descent on a global13objective. That commitment is a modelling choice, not a law of nature, and14the brain does not appear to honour it. Cortical neurons communicate with15discrete, asynchronous electrical events rather than real-valued16activations; synapses are modified by locally available information rather17than by a gradient routed backwards from a distant loss; and much of the18structure of sensory cortex emerges from unsupervised competition rather19than from labelled supervision.2021This chapter develops three families that each relax one of those22commitments while remaining mathematically precise. \emph{Spiking neural23networks} replace the real-valued activation by a temporal train of events,24and the gradient by a local, timing-dependent plasticity rule.25\emph{Self-organizing maps} replace supervised error correction by26competitive learning, and obtain a topology-preserving projection of the27data as an emergent property. \emph{Reservoir computing} keeps the28recurrent architecture but refuses to train it, learning only a linear29readout — which reduces the entire training problem to convex regression.30For each family we give the state equations, an estimation algorithm in31pseudocode, and a figure of the mechanism.3233% ----------------------------------------------------------------------------34\section{Spiking Neural Networks}35% ----------------------------------------------------------------------------3637Spiking networks have been called the third generation of neural network38models \cite{maass1997}: the first generation computes with thresholded39binary units, the second with continuous activations, and the third with40sequences of events in continuous time. A spiking neuron does not output a41number; it outputs a set of firing times $\{t^{(1)}, t^{(2)}, \dots\}$,42conventionally written as a sum of Dirac impulses,43\begin{equation}44 S(t) \;=\; \sum_{f} \delta\!\left(t - t^{(f)}\right),45 \label{eq:bio-spiketrain}46\end{equation}47so that the activation of a neuron is a distribution rather than a scalar.48Information may then be carried by how \emph{often} a neuron fires, or by49\emph{when} it fires — a distinction with no counterpart in the50architectures of the preceding chapters.5152\subsection{The Leaky Integrate-and-Fire Neuron}5354The standard computational unit abstracts the cell membrane as a leaky55capacitor charged by the incoming synaptic current.5657\begin{definition}[Leaky integrate-and-fire neuron]\label{def:bio-lif}58A leaky integrate-and-fire (LIF) neuron with membrane time constant59$\tau_m$, resting potential $V_{\mathrm{rest}}$, membrane resistance $R_m$60and threshold $V_{\mathrm{th}}$ evolves according to61\begin{equation}62 \tau_m \, \frac{\mathrm{d}V(t)}{\mathrm{d}t}63 \;=\; -\bigl(V(t) - V_{\mathrm{rest}}\bigr) \;+\; R_m\, I(t),64 \label{eq:bio-lif-ode}65\end{equation}66supplemented by the fire-and-reset rule67\begin{equation}68 \text{if } V(t^-) \ge V_{\mathrm{th}}:69 \quad70 \text{emit a spike at } t,71 \quad72 V(t^+) \leftarrow V_{\mathrm{reset}},73 \quad74 V \equiv V_{\mathrm{reset}} \text{ on } [t,\, t + t_{\mathrm{ref}}],75 \label{eq:bio-lif-reset}76\end{equation}77where $t_{\mathrm{ref}}$ is the absolute refractory period.78\end{definition}7980Equation~\eqref{eq:bio-lif-ode} is a first-order linear ODE, so its81behaviour under a constant input current $I(t) \equiv I_0$ is available in82closed form. Starting from $V(0) = V_{\mathrm{reset}}$,83\begin{equation}84 V(t)85 \;=\;86 V_{\mathrm{rest}} + R_m I_087 \;+\;88 \bigl(V_{\mathrm{reset}} - V_{\mathrm{rest}} - R_m I_0\bigr)89 \, e^{-t/\tau_m},90 \label{eq:bio-lif-sol}91\end{equation}92an exponential relaxation towards the asymptote93$V_\infty = V_{\mathrm{rest}} + R_m I_0$. Two regimes follow immediately.94If $V_\infty < V_{\mathrm{th}}$ the neuron is \emph{subthreshold} and never95fires, however long we wait: the input is filtered out entirely. If96$V_\infty > V_{\mathrm{th}}$, solving \eqref{eq:bio-lif-sol} for the97threshold crossing gives the interspike interval98\begin{equation}99 T_{\mathrm{ISI}}100 \;=\;101 t_{\mathrm{ref}}102 \;+\;103 \tau_m \,104 \ln\!\left(105 \frac{R_m I_0 - (V_{\mathrm{reset}} - V_{\mathrm{rest}})}106 {R_m I_0 - (V_{\mathrm{th}} - V_{\mathrm{rest}})}107 \right),108 \label{eq:bio-lif-isi}109\end{equation}110and hence the current-to-frequency transfer function, the \emph{f--I curve}111of the neuron,112\begin{equation}113 f(I_0) \;=\; \frac{1}{T_{\mathrm{ISI}}}114 \;=\;115 \left[116 t_{\mathrm{ref}} + \tau_m \ln\!\left(117 \frac{R_m I_0 - V_{\mathrm{reset}} + V_{\mathrm{rest}}}118 {R_m I_0 - V_{\mathrm{th}} + V_{\mathrm{rest}}}119 \right)120 \right]^{-1}.121 \label{eq:bio-lif-fi}122\end{equation}123The refractory term in \eqref{eq:bio-lif-fi} imposes the saturation124$f \le 1/t_{\mathrm{ref}}$: unlike a ReLU, a spiking neuron has a hard125maximum firing rate. Figure~\ref{fig:bio-lif-trace} traces the126corresponding membrane dynamics.127128\begin{figure}[htbp]129 \centering130 \begin{tikzpicture}131 \begin{axis}[132 width=13.4cm, height=6.2cm,133 xmin=0, xmax=42, ymin=-0.08, ymax=1.70,134 xlabel={time $t$ (ms)},135 ylabel={membrane potential $V(t)$},136 ylabel style={font=\small}, xlabel style={font=\small},137 tick label style={font=\scriptsize},138 axis lines=left,139 ytick={0,1}, yticklabels={$V_{\mathrm{reset}}$, $V_{\mathrm{th}}$},140 xtick={0,10,20,30,40},141 clip=false,142 ]143 % --- refractory shading (drawn first, behind everything) ---144 \fill[black!8] (axis cs:10.986,0) rectangle (axis cs:12.986,1.40);145 \fill[black!8] (axis cs:23.972,0) rectangle (axis cs:25.972,1.40);146 \fill[black!8] (axis cs:36.958,0) rectangle (axis cs:38.958,1.40);147 % --- threshold and asymptote ---148 \draw[dashed, black!65, thick] (axis cs:0,1) -- (axis cs:42,1);149 \draw[dotted, black!50, thick] (axis cs:0,1.5) -- (axis cs:42,1.5);150 % --- spikes and resets (unrolled: \foreach variables do not survive151 % the deferred execution of drawing commands inside an axis) ---152 \draw[coutput, line width=1.1pt]153 (axis cs:10.986,0) -- (axis cs:10.986,1.40);154 \draw[coutput, line width=1.1pt]155 (axis cs:23.972,0) -- (axis cs:23.972,1.40);156 \draw[coutput, line width=1.1pt]157 (axis cs:36.958,0) -- (axis cs:36.958,1.40);158 % --- charging ramps: V = 1.5 (1 - e^{-(t-t_0)/10}) ---159 \addplot[cinput, line width=1.1pt, domain=0:10.986, samples=60]160 {1.5*(1-exp(-x/10))};161 \addplot[cinput, line width=1.1pt, domain=12.986:23.972, samples=60]162 {1.5*(1-exp(-(x-12.986)/10))};163 \addplot[cinput, line width=1.1pt, domain=25.972:36.958, samples=60]164 {1.5*(1-exp(-(x-25.972)/10))};165 \addplot[cinput, line width=1.1pt, domain=38.958:42, samples=30]166 {1.5*(1-exp(-(x-38.958)/10))};167 % --- refractory plateaus ---168 \addplot[cinput, line width=1.1pt, domain=10.986:12.986, samples=2]{0};169 \addplot[cinput, line width=1.1pt, domain=23.972:25.972, samples=2]{0};170 \addplot[cinput, line width=1.1pt, domain=36.958:38.958, samples=2]{0};171 % --- annotations ---172 \node[etiquette, anchor=west, text=coutput]173 at (axis cs:11.25,1.20) {spike};174 \node[etiquette, anchor=south] at (axis cs:11.99,0.04)175 {$t_{\mathrm{ref}}$};176 \node[etiquette, anchor=west, fill=white, inner sep=1.5pt]177 at (axis cs:0.8,1.5) {asymptote $V_\infty = R_m I_0$, never reached};178 \end{axis}179 \end{tikzpicture}180 \caption{Membrane potential of an LIF neuron \eqref{eq:bio-lif-ode} driven181 by a constant supra-threshold current, with $\tau_m = 10$~ms,182 $R_m I_0 = 1.5\,V_{\mathrm{th}}$,183 $V_{\mathrm{rest}} = V_{\mathrm{reset}} = 0$ and184 $t_{\mathrm{ref}} = 2$~ms. The potential relaxes exponentially towards185 $V_\infty$, but crosses the dashed threshold first: a spike (red) is186 emitted, the potential is reset, and the shaded refractory window clamps187 it before integration resumes. The period predicted by188 \eqref{eq:bio-lif-isi} is189 $t_{\mathrm{ref}} + \tau_m \ln 3 \approx 12.99$~ms, a firing rate of190 about $77$~Hz.}191 \label{fig:bio-lif-trace}192\end{figure}193194For simulation and for training, \eqref{eq:bio-lif-ode} is discretized with195a fixed step $\Delta t$. Writing $\beta = e^{-\Delta t / \tau_m}$ for the196per-step decay, taking $V_{\mathrm{rest}} = 0$, and folding the synaptic197weights $\vect{w}$ into the input current, one obtains the recurrence used198by every modern spiking-network framework:199\begin{align}200 V[t] &= \beta\, V[t-1]201 \;+\; \vect{w}\transp \vect{S}_{\mathrm{in}}[t]202 \;-\; S[t-1]\, V_{\mathrm{th}},203 \label{eq:bio-lif-discrete}\\[2pt]204 S[t] &= \Theta\!\bigl(V[t] - V_{\mathrm{th}}\bigr),205 \qquad206 \Theta(u) = \begin{cases} 1, & u \ge 0,\\ 0, & u < 0,\end{cases}207 \label{eq:bio-lif-heaviside}208\end{align}209where $\vect{S}_{\mathrm{in}}[t] \in \{0,1\}^{n}$ collects the presynaptic210spikes arriving at step $t$. The last term of \eqref{eq:bio-lif-discrete}211implements a \emph{soft reset} by subtraction, which preserves the212supra-threshold excess; the alternative \emph{hard reset} sets213$V[t] \leftarrow 0$ and discards it. Note the structural resemblance214between \eqref{eq:bio-lif-discrete} and the state update of a gated215recurrent unit: an LIF layer is a recurrent network whose forget gate is216frozen at the constant $\beta$ and whose output nonlinearity is a step.217218\begin{remark}[Biophysically complete models]\label{rem:bio-hh}219The LIF neuron is a caricature. The Hodgkin--Huxley model instead resolves220the ionic conductances explicitly, through four coupled state variables:221\begin{equation}222 C_m \frac{\mathrm{d}V}{\mathrm{d}t}223 = I_{\mathrm{ext}}224 - \bar{g}_{\mathrm{Na}}\, m^{3} h \,(V - E_{\mathrm{Na}})225 - \bar{g}_{\mathrm{K}}\, n^{4} (V - E_{\mathrm{K}})226 - \bar{g}_{L} (V - E_{L}),227 \label{eq:bio-hh}228\end{equation}229each gating variable $x \in \{m, h, n\}$ obeying first-order kinetics230$\dot{x} = \bigl(x_\infty(V) - x\bigr)/\tau_x(V)$. Here the spike is an231emergent consequence of sodium activation rather than an imposed threshold232rule — at a cost of roughly $10^{3}$ floating-point operations per233millisecond of simulated time.234\end{remark}235236\begin{remark}[The Izhikevich compromise]\label{rem:bio-izh}237A two-dimensional reduction of \eqref{eq:bio-hh} retains most of the238qualitative firing repertoire at about $13$ operations per millisecond:239\begin{equation}240 \frac{\mathrm{d}v}{\mathrm{d}t} = 0.04\, v^{2} + 5v + 140 - u + I,241 \qquad242 \frac{\mathrm{d}u}{\mathrm{d}t} = a\,(b v - u),243 \label{eq:bio-izh}244\end{equation}245with the after-spike reset $v \leftarrow c$, $u \leftarrow u + d$ whenever246$v \ge 30$~mV. The four parameters $(a,b,c,d)$ select among regular247spiking, bursting, chattering and fast-spiking regimes.248\end{remark}249250\subsection{Neural Coding}251252Because a spike train is a point process, the question of what the code253\emph{is} becomes explicit. Under \emph{rate coding} the transmitted254quantity is the count obtained by integrating the spike train255\eqref{eq:bio-spiketrain} over a window of length $T$,256\begin{equation}257 r \;=\; \frac{1}{T}\int_{t}^{t+T} S(u)\,\mathrm{d}u258 \;=\; \frac{\bigl|\{f : t \le t^{(f)} < t+T\}\bigr|}{T},259 \label{eq:bio-ratecode}260\end{equation}261which recovers a real-valued activation and makes spiking networks262approximately equivalent to conventional ones, at the price of a latency263and an energy budget proportional to the spike count. Under \emph{temporal}264or time-to-first-spike coding the quantity is the latency $t^{(1)}$ itself,265so a single spike per neuron suffices — the regime in which neuromorphic266hardware achieves its energy advantage. Phase coding (spike time relative267to a background oscillation) and rank-order coding (the permutation in268which a population fires) are further alternatives.269270\subsection{Spike-Timing-Dependent Plasticity}271272The canonical learning rule for spiking networks is local in both space and273time: a synapse is strengthened when it participates causally in a274postsynaptic spike, and weakened when it fires just after one. Writing275$\Delta t = t_{\mathrm{post}} - t_{\mathrm{pre}}$ for the signed latency of276a pre/post spike pair, the classical additive exponential window is277\begin{equation}278 \Delta w(\Delta t)279 \;=\;280 \begin{cases}281 \phantom{-}A_{+}\exp\!\left(-\dfrac{\Delta t}{\tau_{+}}\right),282 & \Delta t > 0283 \qquad \text{(pre before post: potentiation)},\\[2.4ex]284 -A_{-}\exp\!\left(\dfrac{\Delta t}{\tau_{-}}\right),285 & \Delta t \le 0286 \qquad \text{(post before pre: depression)},287 \end{cases}288 \label{eq:bio-stdp}289\end{equation}290with time constants $\tau_{\pm}$ of the order of $20$~ms.291Equation~\eqref{eq:bio-stdp} is an unsupervised Hebbian rule that requires292no error signal, no target and no backward pass: it is a pure causality293detector, and every quantity it needs is available at the synapse itself.294Its shape is plotted in Figure~\ref{fig:bio-stdp}.295296\begin{figure}[htbp]297 \centering298 \begin{tikzpicture}299 \begin{axis}[300 width=12.4cm, height=6.2cm,301 xmin=-80, xmax=80, ymin=-0.85, ymax=1.22,302 axis lines=middle,303 xlabel={$\Delta t = t_{\mathrm{post}} - t_{\mathrm{pre}}$ (ms)},304 ylabel={$\Delta w$},305 xlabel style={font=\small,306 at={(axis description cs:0.5,-0.02)}, anchor=north},307 ylabel style={font=\small, at={(ticklabel* cs:1.0)},308 anchor=south east},309 tick label style={font=\scriptsize},310 xtick={-80,-40,40,80}, ytick={-0.6,-0.3,0.3,0.6,0.9},311 clip=false,312 ]313 \addplot[cgate, line width=1.2pt, domain=0.001:80, samples=120]314 {1.0*exp(-x/17)};315 \addplot[coutput, line width=1.2pt, domain=-80:-0.001, samples=120]316 {-0.6*exp(x/34)};317 \draw[cgate, dotted, thick] (axis cs:0,0) -- (axis cs:0, 1.0);318 \draw[coutput, dotted, thick] (axis cs:0,0) -- (axis cs:0,-0.6);319 \node[etiquette, anchor=west, text=cgate!55!black, align=left]320 at (axis cs:14,0.88)321 {LTP: pre before post,\\[-1pt]$A_{+}e^{-\Delta t/\tau_{+}}$};322 \node[etiquette, anchor=east, text=coutput!85!black, align=right]323 at (axis cs:-14,-0.56)324 {LTD: post before pre,\\[-1pt]$-A_{-}e^{\Delta t/\tau_{-}}$};325 \end{axis}326 \end{tikzpicture}327 \caption{The pair-based STDP window \eqref{eq:bio-stdp}, with328 $A_{+} = 1.0$, $\tau_{+} = 17$~ms, $A_{-} = 0.6$ and329 $\tau_{-} = 34$~ms. A presynaptic spike arriving shortly \emph{before} a330 postsynaptic one strengthens the synapse (green, right half-plane); the331 reverse order weakens it (red, left half-plane). The rule is332 discontinuous at $\Delta t = 0$ and decays to zero for333 $|\Delta t| \gg \tau_{\pm}$, so only near-coincident pairs are334 consequential. The asymmetry $A_{-}\tau_{-} > A_{+}\tau_{+}$ shown here335 makes the net effect of uncorrelated firing depressing, which keeps336 weights from drifting upwards.}337 \label{fig:bio-stdp}338\end{figure}339340Implementing \eqref{eq:bio-stdp} literally would require storing all pairs341of spike times. The standard online form instead keeps one low-pass342\emph{eligibility trace} per terminal, decaying exponentially and343incremented at every spike:344\begin{align}345 \tau_{+}\frac{\mathrm{d}x_{\mathrm{pre}}}{\mathrm{d}t}346 &= -\,x_{\mathrm{pre}}347 + \sum_{f}\delta\!\left(t - t^{(f)}_{\mathrm{pre}}\right),348 \qquad349 \tau_{-}\frac{\mathrm{d}x_{\mathrm{post}}}{\mathrm{d}t}350 = -\,x_{\mathrm{post}}351 + \sum_{f}\delta\!\left(t - t^{(f)}_{\mathrm{post}}\right),352 \label{eq:bio-stdp-traces}\\[2pt]353 \frac{\mathrm{d}w}{\mathrm{d}t}354 &= A_{+}\, x_{\mathrm{pre}}(t)\, S_{\mathrm{post}}(t)355 \;-\; A_{-}\, x_{\mathrm{post}}(t)\, S_{\mathrm{pre}}(t).356 \label{eq:bio-stdp-online}357\end{align}358Equations \eqref{eq:bio-stdp-traces}--\eqref{eq:bio-stdp-online} reproduce359\eqref{eq:bio-stdp} exactly for isolated spike pairs while requiring $O(1)$360memory per synapse, which is why they, and not the pairwise window, are361what neuromorphic hardware implements.362Algorithm~\ref{alg:bio-snn-stdp} assembles the discretized simulation loop;363substituting a richer neuron model such as \eqref{eq:bio-izh} changes only364the membrane update on line~4, leaving the plasticity block untouched.365366\begin{algorithm}[htbp]367\caption{Clocked simulation of an LIF layer with online STDP}368\label{alg:bio-snn-stdp}369\begin{algorithmic}[1]370\Require step $\Delta t$; horizon $T$; weights371 $\mat{W} \in \R^{n_{\mathrm{post}} \times n_{\mathrm{pre}}}$; decays372 $\beta = e^{-\Delta t/\tau_m}$, $\beta_{\pm} = e^{-\Delta t/\tau_{\pm}}$;373 rates $A_{\pm}$; bound $w_{\max}$374\State $\vect{V} \leftarrow \vect{0}$;\;375 $\vect{S}_{\mathrm{post}} \leftarrow \vect{0}$;\;376 $\vect{x}_{\mathrm{pre}} \leftarrow \vect{0}$;\;377 $\vect{x}_{\mathrm{post}} \leftarrow \vect{0}$;\;378 $\vect{\rho} \leftarrow \vect{0}$379 \Comment{$\vect{\rho}$: refractory counters}380\For{$t = 1, \dots, T/\Delta t$}381 \State $\vect{S}_{\mathrm{pre}} \leftarrow$ presynaptic spikes at step $t$382 \State $\vect{V} \leftarrow \beta\,\vect{V}383 + \mat{W}\,\vect{S}_{\mathrm{pre}}384 - V_{\mathrm{th}}\,\vect{S}_{\mathrm{post}}$385 \Comment{leak, integrate, soft reset \eqref{eq:bio-lif-discrete}}386 \State $\vect{V} \leftarrow \vect{V} \odot \mathbf{1}[\vect{\rho} = 0]$387 \Comment{clamp refractory units \eqref{eq:bio-lif-reset}}388 \State $\vect{S}_{\mathrm{post}} \leftarrow389 \Theta(\vect{V} - V_{\mathrm{th}}) \odot \mathbf{1}[\vect{\rho} = 0]$390 \Comment{\eqref{eq:bio-lif-heaviside}}391 \State $\vect{\rho} \leftarrow \max\!\bigl(\vect{\rho} - 1,\, 0\bigr)392 + \lceil t_{\mathrm{ref}}/\Delta t \rceil\,393 \vect{S}_{\mathrm{post}}$394 \Statex \hspace{\algorithmicindent}\textit{plasticity: traces first, then395 the two-term update}396 \State $\vect{x}_{\mathrm{pre}} \leftarrow397 \beta_{+}\,\vect{x}_{\mathrm{pre}} + \vect{S}_{\mathrm{pre}}$;\quad398 $\vect{x}_{\mathrm{post}} \leftarrow399 \beta_{-}\,\vect{x}_{\mathrm{post}} + \vect{S}_{\mathrm{post}}$400 \Comment{\eqref{eq:bio-stdp-traces}}401 \State $\mat{W} \leftarrow \mat{W}402 + A_{+}\,\vect{S}_{\mathrm{post}}\,\vect{x}_{\mathrm{pre}}\transp403 - A_{-}\,\vect{x}_{\mathrm{post}}\,\vect{S}_{\mathrm{pre}}\transp$404 \Comment{rule \eqref{eq:bio-stdp-online}}405 \State $\mat{W} \leftarrow \mathrm{clip}\bigl(\mat{W},\, 0,\, w_{\max}\bigr)$406 \Comment{additive STDP is otherwise unbounded}407\EndFor408\State \Return $\mat{W}$409\end{algorithmic}410\end{algorithm}411412\subsection{Surrogate Gradients}413414STDP is unsupervised and cannot by itself solve a supervised task. To train415a deep spiking network by gradient descent one must differentiate416\eqref{eq:bio-lif-heaviside}, and the derivative of the Heaviside step is a417Dirac impulse: zero almost everywhere, unbounded at the threshold. Gradient418descent through it is impossible. The \emph{surrogate gradient} method419keeps the step function in the forward pass but substitutes a smooth,420bounded pseudo-derivative in the backward pass, for instance the421fast-sigmoid derivative422\begin{equation}423 \frac{\partial S}{\partial V}424 \;\approx\;425 \sigma'_{\mathrm{surr}}(V)426 \;=\;427 \frac{1}{\bigl(1 + \gamma\,|V - V_{\mathrm{th}}|\bigr)^{2}},428 \qquad \gamma > 0,429 \label{eq:bio-surrogate}430\end{equation}431which peaks at the threshold and decays away from it, so that only neurons432close to firing receive appreciable credit. With \eqref{eq:bio-surrogate}433in place the discretized network \eqref{eq:bio-lif-discrete} becomes an434ordinary recurrent network over the time axis, trainable by435backpropagation through time (Algorithm~\ref{alg:bio-surrogate}). The436steepness $\gamma$ controls a bias--variance trade-off: large $\gamma$437approaches the true, useless derivative, while small $\gamma$ leaks438gradient to neurons far from threshold.439440\begin{algorithm}[htbp]441\caption{Surrogate-gradient training of a deep spiking network}442\label{alg:bio-surrogate}443\begin{algorithmic}[1]444\Require encoded input spike trains $\vect{S}^{(0)}[1{:}T]$; targets445 $\vect{y}$; layers $\ell = 1, \dots, L$; steepness $\gamma$; rate $\eta$446\For{each mini-batch}447 \State $\vect{V}^{(\ell)} \leftarrow \vect{0}$,\;448 $\vect{S}^{(\ell)} \leftarrow \vect{0}$ for all $\ell$449 \For{$t = 1, \dots, T$}450 \Comment{forward pass: the exact step function is retained}451 \For{$\ell = 1, \dots, L$}452 \State $\vect{V}^{(\ell)}[t] \leftarrow453 \beta\, \vect{V}^{(\ell)}[t-1]454 + \mat{W}^{(\ell)} \vect{S}^{(\ell-1)}[t]455 - V_{\mathrm{th}}\, \vect{S}^{(\ell)}[t-1]$456 \State $\vect{S}^{(\ell)}[t] \leftarrow457 \Theta\bigl(\vect{V}^{(\ell)}[t] - V_{\mathrm{th}}\bigr)$458 \EndFor459 \EndFor460 \State $\hat{\vect{y}} \leftarrow461 \softmax\bigl(\textstyle\sum_{t} \vect{V}^{(L)}[t]\bigr)$462 \Comment{or a spike-count readout \eqref{eq:bio-ratecode}}463 \State $\Loss \leftarrow \mathrm{CE}(\hat{\vect{y}}, \vect{y})$464 \State backpropagate through time, replacing every factor465 $\partial \vect{S}^{(\ell)}[t] / \partial \vect{V}^{(\ell)}[t]$466 by $\sigma'_{\mathrm{surr}}$ of \eqref{eq:bio-surrogate}467 \State $\mat{W}^{(\ell)} \leftarrow \mat{W}^{(\ell)}468 - \eta\, \nabla_{\mat{W}^{(\ell)}} \Loss$ for all $\ell$469\EndFor470\end{algorithmic}471\end{algorithm}472473% ----------------------------------------------------------------------------474\section{Self-Organizing Maps}475% ----------------------------------------------------------------------------476477The self-organizing map \cite{kohonen1990} is an unsupervised, competitive478algorithm that projects a high-dimensional data space onto a479low-dimensional discrete lattice — usually a two-dimensional grid — while480preserving topology: inputs close in $\R^{n}$ are mapped to units close on481the lattice. Unlike the projection produced by an autoencoder, the output482space is prescribed and discrete, and the mapping is learned without any483gradient.484485Each unit $i$ of the lattice carries two objects: a fixed position486$\vect{r}_i$ \emph{on the lattice}, and a trainable codebook vector487$\vect{m}_i \in \R^{n}$ living \emph{in the data space}. Learning488alternates two steps for each presented sample $\vect{x}(t)$.489490\paragraph{Competition.} The best matching unit (BMU) is the nearest491codebook vector,492\begin{equation}493 c(t) \;=\; \argmin_{i} \bigl\| \vect{x}(t) - \vect{m}_i(t) \bigr\|,494 \label{eq:bio-som-bmu}495\end{equation}496a nearest-prototype rule identical to the assignment step of $k$-means.497498\paragraph{Cooperation.} What distinguishes the SOM from $k$-means is that499the winner does not adapt alone. A neighbourhood kernel, measured in500\emph{lattice} coordinates rather than data coordinates, spreads the update501to nearby units:502\begin{equation}503 h_{ci}(t)504 \;=\;505 \exp\!\left(506 -\,\frac{\bigl\|\vect{r}_c - \vect{r}_i\bigr\|^{2}}{2\,\sigma^{2}(t)}507 \right)508 \;\in\; (0, 1],509 \label{eq:bio-som-neigh}510\end{equation}511so that $h_{cc} = 1$ and $h_{ci}$ decays with lattice distance. The512codebook update is then a shrinkage of every unit towards the current513sample, weighted by that kernel:514\begin{equation}515 \vect{m}_i(t+1)516 \;=\;517 \vect{m}_i(t)518 \;+\;519 \alpha(t)\, h_{ci}(t)\,520 \bigl[\vect{x}(t) - \vect{m}_i(t)\bigr].521 \label{eq:bio-som-update}522\end{equation}523Because \eqref{eq:bio-som-update} couples lattice neighbours to a common524data point, units adjacent on the grid are dragged towards adjacent regions525of the data space. This coupling, and not any explicit constraint, is what526produces topology preservation.527528Both the learning rate and the neighbourhood radius are annealed,529\begin{equation}530 \alpha(t) = \alpha_0\, e^{-t/\lambda_{\alpha}},531 \qquad532 \sigma(t) = \sigma_0\, e^{-t/\lambda_{\sigma}},533 \label{eq:bio-som-schedule}534\end{equation}535which splits training into two phases with distinct roles. While $\sigma$536is large the kernel \eqref{eq:bio-som-neigh} is nearly flat and the whole537map moves almost rigidly, unfolding into the data cloud and fixing the538global ordering. As $\sigma$ shrinks towards one lattice unit the updates539become local and the phase turns into fine quantization. Ordering, once540achieved, is never undone — which is the practical reason the annealing541must be slow. Figure~\ref{fig:bio-som} shows one such update.542543\begin{figure}[htbp]544 \centering545 \begin{tikzpicture}[font=\small]546 % ---- input vector -------------------------------------------------547 \node[ninput, minimum size=9mm] (x) at (-1.1, 4.5) {$\vect{x}$};548 \foreach \r in {1,...,5}{549 \draw[black!35, -{Stealth[length=1.6mm]}] (x) -- (1.02, 1.5*\r);550 }551 \node[etiquette, anchor=north, align=center, text width=2.6cm]552 at (-1.1, 3.9) {compared with\\all units,553 \eqref{eq:bio-som-bmu}};554 % ---- neighbourhood radius (drawn first, so the opaque unit fills555 % hide the arcs that would otherwise cross their labels) -------556 \draw[dashed, cgate!70!black, thick] (3.0,3.0) circle (2.25cm);557 \node[etiquette, fill=white, inner sep=1.5pt, text=cgate!50!black]558 at (3.58, 0.83) {$\sigma(t)$};559 % ---- lattice ------------------------------------------------------560 \foreach \c/\r/\h/\f in {%561 1/1/0.64/53, 1/2/0.80/64, 1/3/0.64/53, 1/4/0.33/31, 1/5/0.11/16,562 2/1/0.80/64, 2/3/0.80/64, 2/4/0.41/37, 2/5/0.14/17,563 3/1/0.64/53, 3/2/0.80/64, 3/3/0.64/53, 3/4/0.33/31, 3/5/0.11/16,564 4/1/0.33/31, 4/2/0.41/37, 4/3/0.33/31, 4/4/0.17/20, 4/5/0.06/12,565 5/1/0.11/16, 5/2/0.14/17, 5/3/0.11/16, 5/4/0.06/12, 5/5/0.02/9}{566 \node[neuron, minimum size=9mm, font=\tiny,567 fill=chidden!\f, draw=chidden!80!black]568 (u\c\r) at (1.5*\c, 1.5*\r) {\h};569 }570 % ---- best matching unit -------------------------------------------571 \node[neuron, minimum size=9mm, font=\tiny, fill=chidden!78,572 draw=coutput, line width=1.1pt] (bmu) at (3.0, 3.0) {1.00};573 % ---- profile of the update along the winner's row -----------------574 \foreach \c/\l in {1/0.80, 2/1.00, 3/0.80, 4/0.41, 5/0.14}{575 \draw[cinput!85!black, line width=2.4pt]576 (1.5*\c - \l*0.5, 0.15) -- (1.5*\c + \l*0.5, 0.15);577 }578 \node[etiquette, anchor=east, align=right, text width=2.9cm]579 at (0.5, 0.15) {update size\\$\alpha(t)\,h_{ci}(t)$};580 % ---- legend -------------------------------------------------------581 \node[etiquette, anchor=west, align=left] at (8.2, 3.15)582 {\textcolor{coutput}{thick ring}:\\BMU $c$};583 \node[etiquette, anchor=west, align=left] at (8.2, 2.15)584 {numbers: $h_{ci}(t)$};585 \end{tikzpicture}586 \caption{One SOM update on a $5 \times 5$ lattice. The sample $\vect{x}$587 is compared with every codebook vector, and the winner $c$ (red ring) is588 the nearest one, \eqref{eq:bio-som-bmu}. The number inside each unit is589 its neighbourhood weight $h_{ci}$ from \eqref{eq:bio-som-neigh} with590 $\sigma = 1.5$ lattice units, and the fill intensity is proportional to591 it; the dashed circle marks the radius $\sigma(t)$. The bars at the592 bottom give the profile of the update magnitude593 \eqref{eq:bio-som-update} along the winner's row: the whole594 neighbourhood moves towards $\vect{x}$, by an amount decaying with595 lattice distance. Note that distances in \eqref{eq:bio-som-neigh} are596 measured on the lattice, whereas the competition597 \eqref{eq:bio-som-bmu} is decided in the data space.}598 \label{fig:bio-som}599\end{figure}600601A batch variant removes the dependence on presentation order by recomputing602every codebook vector as a kernel-weighted mean of the assigned samples,603\begin{equation}604 \vect{m}_i605 \;=\;606 \frac{\sum_{t} h_{c(t)\,i}\; \vect{x}(t)}607 {\sum_{t} h_{c(t)\,i}},608 \label{eq:bio-som-batch}609\end{equation}610which is to \eqref{eq:bio-som-update} what Lloyd's algorithm is to online611$k$-means. Map quality is assessed by two complementary scalars, the612quantization error and the topographic error,613\begin{equation}614 \mathrm{QE} = \frac{1}{N}\sum_{t=1}^{N}615 \bigl\|\vect{x}(t) - \vect{m}_{c(t)}\bigr\|,616 \qquad617 \mathrm{TE} = \frac{1}{N}\sum_{t=1}^{N}618 \mathbf{1}\!\left[619 \vect{r}_{c_1(t)} \text{ and } \vect{r}_{c_2(t)}620 \text{ non-adjacent}621 \right],622 \label{eq:bio-som-errors}623\end{equation}624where $c_1$ and $c_2$ denote the first and second best matching units. The625pair matters: QE alone is minimized by abandoning topology altogether, and626TE alone by collapsing every codebook vector onto the same point.627Algorithm~\ref{alg:bio-som} states the complete online procedure; replacing628its inner loop by \eqref{eq:bio-som-batch} yields the batch variant.629630\begin{algorithm}[htbp]631\caption{Self-organizing map — online training}632\label{alg:bio-som}633\begin{algorithmic}[1]634\Require data $\{\vect{x}(t)\}_{t=1}^{N}$; lattice positions635 $\{\vect{r}_i\}_{i=1}^{M}$; $\alpha_0$, $\sigma_0$, $\lambda_\alpha$,636 $\lambda_\sigma$; epochs $E$637\State initialize $\vect{m}_i$ by random sampling of the data, or on the638 plane of the two leading principal components639\For{$e = 1, \dots, E$}640 \For{each sample $\vect{x}(t)$, in random order}641 \State $c \leftarrow \argmin_{i}\|\vect{x}(t) - \vect{m}_i\|$642 \Comment{competition \eqref{eq:bio-som-bmu}}643 \State $\alpha \leftarrow \alpha_0 e^{-t/\lambda_\alpha}$;\quad644 $\sigma \leftarrow \sigma_0 e^{-t/\lambda_\sigma}$645 \Comment{annealing \eqref{eq:bio-som-schedule}}646 \For{each unit $i = 1, \dots, M$}647 \State $h \leftarrow \exp\bigl(-\|\vect{r}_c - \vect{r}_i\|^{2} /648 (2\sigma^{2})\bigr)$649 \Comment{lattice distance \eqref{eq:bio-som-neigh}}650 \State $\vect{m}_i \leftarrow \vect{m}_i651 + \alpha\, h\, \bigl(\vect{x}(t) - \vect{m}_i\bigr)$652 \Comment{cooperation \eqref{eq:bio-som-update}}653 \EndFor654 \EndFor655 \State monitor QE and TE of \eqref{eq:bio-som-errors}656\EndFor657\State \Return $\{\vect{m}_i\}_{i=1}^{M}$658\end{algorithmic}659\end{algorithm}660661% ----------------------------------------------------------------------------662\section{Reservoir Computing and Echo State Networks}663% ----------------------------------------------------------------------------664665Training a recurrent network by backpropagation through time is expensive666and numerically delicate. Reservoir computing takes a radical shortcut:667keep a large, sparse, randomly initialized and permanently frozen recurrent668network — the reservoir — and train only a linear readout on top of its669states \cite{jaeger2001}. The reservoir serves as a fixed,670high-dimensional, nonlinear expansion of the input history, and the671learning problem that remains is linear regression.672673The echo state network state update, with leak rate $\alpha \in (0,1]$, is674\begin{equation}675 \vect{h}_t676 \;=\;677 (1 - \alpha)\,\vect{h}_{t-1}678 \;+\;679 \alpha\,\tanh\!\bigl(680 \mat{W}_{\mathrm{in}}\,\vect{u}_t681 + \mat{W}\,\vect{h}_{t-1}682 + \vect{b}683 \bigr),684 \label{eq:bio-esn-state}685\end{equation}686and the trained readout is the affine map687\begin{equation}688 \vect{y}_t \;=\; \mat{W}_{\mathrm{out}}\,689 \begin{bmatrix} 1 \\ \vect{u}_t \\ \vect{h}_t \end{bmatrix}.690 \label{eq:bio-esn-readout}691\end{equation}692Only $\mat{W}_{\mathrm{out}}$ is learned: $\mat{W}_{\mathrm{in}}$,693$\mat{W}$ and $\vect{b}$ are drawn once at random and never touched. For694this to be sensible the reservoir must forget, so that its state is695asymptotically a function of the input history alone and not of an696arbitrary initial condition.697698\begin{property}[Echo state property]\label{prop:bio-esp}699The reservoir \eqref{eq:bio-esn-state} has the echo state property when,700for any two initial states $\vect{h}_0$ and $\vect{h}'_0$ driven by the701same input sequence, $\|\vect{h}_t - \vect{h}'_t\| \to 0$ as702$t \to \infty$. A sufficient condition is $\sigma_{\max}(\mat{W}) < 1$; in703practice one uses the far less conservative spectral-radius heuristic704\begin{equation}705 \rho(\mat{W}) \;=\; \max_{i} \bigl|\lambda_i(\mat{W})\bigr| \;<\; 1,706 \label{eq:bio-esn-spectral}707\end{equation}708tuning $\rho$ just below unity. The reservoir is then a \emph{fading709memory} filter: larger $\rho$ lengthens the memory, smaller $\rho$ shortens710it, and $\rho$ slightly above one often still works on strongly driven711tasks.712\end{property}713714Condition \eqref{eq:bio-esn-spectral} is enforced by construction rather715than by optimization. One draws a sparse random matrix716$\mat{W}_{\mathrm{raw}}$ — typically one to five per cent of entries717nonzero — computes its spectral radius numerically, and rescales:718\begin{equation}719 \mat{W}720 \;\leftarrow\;721 \frac{\rho^{\star}}{\rho(\mat{W}_{\mathrm{raw}})}\; \mat{W}_{\mathrm{raw}},722 \qquad \rho^{\star} \lesssim 1 .723 \label{eq:bio-esn-rescale}724\end{equation}725726The decisive consequence of freezing the recurrence is that the training727objective becomes convex. Collecting the extended states of all retained728time steps into $\mat{H} \in \R^{(1 + n_u + n_h) \times T}$ and the targets729into $\mat{Y} \in \R^{n_y \times T}$, the ridge-regularized least-squares730solution is available in closed form:731\begin{equation}732 \mat{W}_{\mathrm{out}}733 \;=\;734 \argmin_{\mat{W}}735 \left\{736 \bigl\|\mat{W}\mat{H} - \mat{Y}\bigr\|_{F}^{2}737 + \lambda \bigl\|\mat{W}\bigr\|_{F}^{2}738 \right\}739 \;=\;740 \mat{Y}\mat{H}\transp741 \bigl(\mat{H}\mat{H}\transp + \lambda \mat{I}\bigr)^{-1}.742 \label{eq:bio-esn-ridge}743\end{equation}744There is no local minimum, no learning rate, no vanishing gradient and no745backward pass through time: one matrix inversion of size746$(1 + n_u + n_h)$ replaces the entire training procedure. The ridge term is747not optional — reservoir states are strongly correlated, so748$\mat{H}\mat{H}\transp$ is badly conditioned.749Algorithm~\ref{alg:bio-esn} gives the complete recipe, and750Figure~\ref{fig:bio-esn} the architecture.751752\begin{figure}[htbp]753 \centering754 \begin{tikzpicture}[font=\small]755 % ---- reservoir boundary -------------------------------------------756 \draw[dashed, black!55, thick]757 (4,0) ellipse [x radius=2.4cm, y radius=1.8cm];758 % ---- reservoir units ----------------------------------------------759 \node[nhidden, minimum size=6mm] (n1) at (2.55, 0.55) {};760 \node[nhidden, minimum size=6mm] (n2) at (2.55,-0.65) {};761 \node[nhidden, minimum size=6mm] (n3) at (3.60, 1.15) {};762 \node[nhidden, minimum size=6mm] (n4) at (3.75,-1.15) {};763 \node[nhidden, minimum size=6mm] (n5) at (4.10, 0.05) {};764 \node[nhidden, minimum size=6mm] (n6) at (4.95, 1.05) {};765 \node[nhidden, minimum size=6mm] (n7) at (5.15,-0.85) {};766 \node[nhidden, minimum size=6mm] (n8) at (5.55, 0.10) {};767 % ---- fixed sparse recurrent connections ---------------------------768 \begin{scope}[black!40, -{Stealth[length=1.6mm]}, semithick]769 \draw (n1) -- (n5);770 \draw (n5) to[bend left=15] (n3);771 \draw (n3) -- (n6);772 \draw (n6) to[bend left=12] (n8);773 \draw (n8) -- (n7);774 \draw (n7) -- (n4);775 \draw (n4) to[bend left=12] (n2);776 \draw (n2) -- (n1);777 \draw (n5) to[bend right=15] (n7);778 \draw (n6) to[bend left=18] (n5);779 \draw (n2) to[bend right=12] (n5);780 \draw (n5) to[out=-115, in=-65, looseness=6] (n5);781 \end{scope}782 % ---- input --------------------------------------------------------783 \node[ninput, minimum size=9mm] (u) at (0,0) {$\vect{u}_t$};784 \draw[fleche, black!55] (u) -- (n1);785 \draw[fleche, black!55] (u) -- (n2);786 \node[etiquette, anchor=east] at (1.68, 0.80)787 {$\mat{W}_{\mathrm{in}}$ (fixed)};788 % ---- readout ------------------------------------------------------789 \node[noutput, minimum size=9mm] (y) at (8.7,0) {$\vect{y}_t$};790 \draw[fleche, coutput, line width=1.1pt] (n6) -- (y);791 \draw[fleche, coutput, line width=1.1pt] (n8) -- (y);792 \draw[fleche, coutput, line width=1.1pt] (n7) -- (y);793 \node[etiquette, anchor=south, text=coutput!85!black] at (7.4, 0.80)794 {$\mat{W}_{\mathrm{out}}$ (\textbf{trained})};795 % ---- titles -------------------------------------------------------796 \node[anchor=south, font=\small] at (4, 2.05)797 {Reservoir: $n_h$ fixed random units};798 \node[etiquette, anchor=north, align=center] at (4, -2.05)799 {$\mat{W}$ sparse, random, rescaled to800 $\rho(\mat{W}) = \rho^{\star} < 1$, \eqref{eq:bio-esn-rescale}};801 \end{tikzpicture}802 \caption{An echo state network. The input weights803 $\mat{W}_{\mathrm{in}}$ and the sparse recurrent matrix $\mat{W}$ (grey)804 are drawn at random and \emph{never trained}; they merely expand the805 input history into a high-dimensional dynamical state806 \eqref{eq:bio-esn-state}, whose fading memory is guaranteed by the807 spectral-radius condition \eqref{eq:bio-esn-spectral}. Only the readout808 $\mat{W}_{\mathrm{out}}$ (red) is learned, and it is learned in closed809 form by ridge regression \eqref{eq:bio-esn-ridge}. For legibility only810 three readout connections are drawn; in fact every reservoir state, and811 the input itself, feeds the readout \eqref{eq:bio-esn-readout}.}812 \label{fig:bio-esn}813\end{figure}814815\begin{algorithm}[htbp]816\caption{Echo state network — construction and closed-form training}817\label{alg:bio-esn}818\begin{algorithmic}[1]819\Require sequence $\{(\vect{u}_t, \vect{y}^{\star}_t)\}_{t=1}^{T}$;820 reservoir size $n_h$; sparsity $s$; target radius $\rho^{\star}$; leak821 $\alpha$; ridge $\lambda$; washout $T_0$822\Statex \textit{1. build the reservoir, once, at random}823\State draw $\mat{W}_{\mathrm{in}} \in \R^{n_h \times n_u}$ with i.i.d.\824 entries uniform on $[-a, a]$825\State draw $\mat{W}_{\mathrm{raw}} \in \R^{n_h \times n_h}$ with a fraction826 $s$ of nonzero i.i.d.\ entries827\State $\mat{W} \leftarrow828 \bigl(\rho^{\star}/\rho(\mat{W}_{\mathrm{raw}})\bigr)\,829 \mat{W}_{\mathrm{raw}}$830 \Comment{enforce \eqref{eq:bio-esn-spectral} by831 \eqref{eq:bio-esn-rescale}}832\Statex \textit{2. drive the reservoir and harvest its states}833\State $\vect{h}_0 \leftarrow \vect{0}$834\For{$t = 1, \dots, T$}835 \State $\vect{h}_t \leftarrow (1-\alpha)\,\vect{h}_{t-1}836 + \alpha \tanh\bigl(\mat{W}_{\mathrm{in}}\vect{u}_t837 + \mat{W}\vect{h}_{t-1} + \vect{b}\bigr)$838 \Comment{\eqref{eq:bio-esn-state}}839 \If{$t > T_0$}840 \State append $[\,1;\, \vect{u}_t;\, \vect{h}_t\,]$ as a column of841 $\mat{H}$, and $\vect{y}^{\star}_t$ as a column of $\mat{Y}$842 \EndIf843\EndFor844\Statex \textit{3. solve one convex problem}845\State $\mat{W}_{\mathrm{out}} \leftarrow \mat{Y}\mat{H}\transp846 \bigl(\mat{H}\mat{H}\transp + \lambda\mat{I}\bigr)^{-1}$847 \Comment{ridge regression \eqref{eq:bio-esn-ridge}}848\State \Return $\mat{W}_{\mathrm{in}}$, $\mat{W}$, $\mat{W}_{\mathrm{out}}$849\end{algorithmic}850\end{algorithm}851852The discarded prefix of length $T_0$ in Algorithm~\ref{alg:bio-esn} is not853a detail: by Property~\ref{prop:bio-esp} the influence of $\vect{h}_0$854decays only asymptotically, so the earliest states are contaminated by the855arbitrary initial condition and would bias the regression. Echo state856networks are competitive on chaotic time-series prediction, at a training857cost orders of magnitude below that of a fully trained recurrent network.858859\begin{remark}[Liquid state machines]\label{rem:bio-lsm}860The liquid state machine is the spiking counterpart of the echo state861network: the reservoir is a recurrent population of leaky862integrate-and-fire neurons in the sense of Definition~\ref{def:bio-lif} —863the liquid — and the readout is trained on its instantaneous state.864Real-time universal computing power follows from two conditions: a865\emph{separation property} for the liquid, meaning that different input866histories drive measurably different states, and an \emph{approximation867property} for the readout. The idea has outlived its original setting in868\emph{physical} reservoir computing, where the fixed nonlinear dynamics are869supplied by photonic, memristive or even mechanical substrates rather than870by simulated neurons.871\end{remark}872873% ----------------------------------------------------------------------------874\section{What Is Learned, What Is Fixed, What Emerges}875% ----------------------------------------------------------------------------876877The three families of this chapter occupy three distinct positions on the878question of where the adaptivity of a network should reside;879Table~\ref{tab:bio-comparison} summarizes them.880881\begin{table}[htbp]882 \centering883 \small884 \caption{The three biologically inspired paradigms compared. None of them885 uses a global gradient of a supervised loss in its native form.}886 \label{tab:bio-comparison}887 \begin{tabular}{@{}lllll@{}}888 \toprule889 & \textbf{Fixed} & \textbf{Learned} & \textbf{Learning signal}890 & \textbf{Emergent property} \\891 \midrule892 SNN with STDP893 & neuron dynamics894 & all synapses895 & local spike timing896 & causality detection \\897 SOM898 & lattice topology899 & codebook $\vect{m}_i$900 & competition, no error901 & topology preservation \\902 ESN903 & $\mat{W}_{\mathrm{in}}$, $\mat{W}$904 & readout only905 & convex least squares906 & fading memory \\907 \bottomrule908 \end{tabular}909\end{table}910911\begin{remark}[The common thread]\label{rem:bio-thread}912Each paradigm buys something by giving up end-to-end differentiability.913Spiking networks buy energy: under temporal coding a neuron may transmit914its message with a single event, which is why these models map so naturally915onto event-driven neuromorphic silicon. Self-organizing maps buy916interpretability: the lattice is a fixed, inspectable output space, so the917learned representation can be read off directly rather than probed.918Reservoir computing buys convexity, and with it a training procedure that919is exact, fast and free of the pathologies of backpropagation through time.920The price, uniformly, is expressive power on large supervised problems —921precisely where the gradient-trained architectures of the preceding922chapters remain unmatched. The surrogate-gradient method of923\eqref{eq:bio-surrogate} is the most successful attempt so far to have924both, restoring differentiability to the spiking forward pass without925abandoning its event-driven semantics.926\end{remark}927