An interactive tool for computational neuroscience students to build intuition for how the eigenvalues and eigenvectors of a weight matrix govern the dynamics of a small recurrent neural network — in both discrete and continuous time.
A 3-neuron recurrent network is small enough that we can compute its eigendecomposition analytically and watch the results in real time. Every slider you move — gain, leak, update fraction — changes the eigenvalues, and the dynamics panel instantly shows what that means for how activity evolves. This bridges the gap between the abstract linear algebra and the felt experience of a network converging, oscillating, or diverging.
Three rate-coded neurons, indexed
The default connectivity is a forward ring with self-excitation:
This means N1 receives from N3, N2 from N1, N3 from N2 — activity rotates around the ring. The eigenvalues of this
The tool supports two formulations of RNN dynamics, selectable via the Discrete / Continuous toggle.
where:
| Symbol | Meaning |
|---|---|
| firing rate vector at step |
|
| global gain | |
| update fraction (leak) | |
| pointwise nonlinearity ( |
What
Linearising around the origin gives the update matrix:
Its eigenvalues
where
For the forward ring,
At
or equivalently:
| Symbol | Meaning |
|---|---|
| leak / passive decay rate | |
| membrane time constant |
This is the standard leaky rate model from computational neuroscience (Wilson & Cowan 1972, Abbott 1994). Each neuron integrates its recurrent input and decays back to zero with time constant
What
The default continuous-mode connectivity is the antisymmetric ring:
This has purely imaginary eigenvalues
The Jacobian at the origin is:
Its eigenvalues are:
The stability criterion is:
For the antisymmetric ring with
So the antisymmetric ring always produces damped oscillations — the oscillatory frequency is set by
The oscillation frequency (imaginary part) and decay rate (real part) are:
The toggle switches between:
-
tanh:
$\varphi(x) = \tanh(x)$ , bounded output$\in (-1, 1)$ . The standard nonlinearity in computational neuroscience models (Sompolinsky, Crisanti & Sommers 1988). Its derivative at zero is 1, so the linearisation at the origin is exact. Away from zero,$|\varphi'(x)| < 1$ — the effective gain decreases, which is what bounds growing modes into limit cycles. -
linear:
$\varphi(x) = x$ , i.e. no nonlinearity. In this mode the system is purely linear: eigenvalues fully determine everything and activity either grows without bound, decays, or oscillates forever at fixed amplitude. Good for studying the eigenvalue picture in isolation.
The 3D panel shows the eigenvectors of the effective linearised matrix — either
Why eigenvectors matter. Any initial condition
where
In discrete mode, a unit circle is drawn in the 3D view as a reference — eigenvectors whose corresponding
The default IC places all activity in N1 and none in N2 or N3. For the forward ring, this is a maximally asymmetric state: it has large projections onto the complex eigenvectors
| Experiment | What to observe |
|---|---|
| Discrete, |
Perfect period-3 rotation: $ |
| Reduce |
Oscillation damps as $ |
| Linear mode, gain sweep | Watch eigenvalues cross $ |
| Continuous, sweep |
Decay rate changes; frequency unchanged — |
| Add self-connections ( |
Real eigenvalue shifts right; symmetric mode destabilises first |
| Add backward inhibition ( |
Purely imaginary spectrum; rotation without fixed-point competition |
| Randomise IC | Different eigenmode projections |
Discrete step uses the leaky update rule directly, one step per animation frame (speed-controlled).
Continuous step uses a 4th-order Runge-Kutta integrator with adaptive sub-stepping: the internal step size is capped at
Eigendecomposition is computed analytically via the characteristic polynomial of the
- Wilson, H.R. & Cowan, J.D. (1972). Excitatory and inhibitory interactions in localized populations of model neurons. Biophysical Journal, 12(1), 1–24.
- Abbott, L.F. (1994). Decoding neuronal firing and modelling neural networks. Quarterly Reviews of Biophysics, 27(3), 291–331.
- Sompolinsky, H., Crisanti, A. & Sommers, H.J. (1988). Chaos in random neural networks. Physical Review Letters, 61(3), 259.
- Strogatz, S.H. (2015). Nonlinear Dynamics and Chaos. Westview Press. (Chapters 7–8 for Hopf bifurcations.)
- Dayan, P. & Abbott, L.F. (2001). Theoretical Neuroscience. MIT Press. (Chapter 7 for network models.)
No build step. Open index.html in any modern browser.
git clone https://github.com/MRIO/rnn-eigenspace-explorer.git
cd rnn-eigenspace-explorer
open index.html # macOS
# or: xdg-open index.html (Linux)
# or just drag the file into your browser