Training Theory
In reservoir computing, the recurrent weight matrix and input weight matrix are fixed at initialization. The only learned component is the readout weight matrix , which maps the high-dimensional reservoir state to the desired output. Because the readout is linear, training reduces to solving a system of linear equations — a convex optimization problem with a unique global minimum and no gradient pathology.
This page derives the three training algorithms implemented in SPIRES: ridge regression (batch, offline), recursive least squares (streaming, second-order), and the online delta rule (streaming, first-order).
Problem Setup
Suppose we drive the reservoir with a training input sequence and collect the corresponding reservoir states , discarding an initial transient of steps to allow the reservoir to wash out its initial conditions.
We arrange the states and targets into matrices:
where is the state matrix (or design matrix) and is the target matrix. Each row of is a snapshot of the reservoir state at one time step.
Ridge Regression (Batch Training)
Ordinary Least Squares
The simplest approach is to find that minimizes the sum of squared errors:
where is the Frobenius norm. Taking the gradient and setting it to zero:
Solving:
This is the ordinary least squares (OLS) solution. It is the unique minimum of a convex quadratic, so there are no local minima or saddle points.
The Overfitting Problem
In reservoir computing, the state dimensionality is typically large (hundreds to thousands of neurons), while the number of training samples may be comparable in magnitude. When is large relative to the number of samples, OLS exhibits severe overfitting: the readout learns noise in the training data and generalizes poorly.
Mathematically, the problem is that becomes ill-conditioned (has near-zero eigenvalues), causing the inverse to amplify noise. The resulting weight vector has large magnitude, indicating that the readout is fitting to tiny fluctuations in the reservoir state.
Tikhonov Regularization (Ridge Regression)
The solution is to add a penalty on the magnitude of the weights. Ridge regression adds an regularization term:
where is the regularization parameter. The penalty discourages large weights, preferring solutions that are smooth combinations of reservoir states.
Taking the gradient and setting it to zero:
Solving:
This is the ridge regression solution, also known as Tikhonov regularization in the numerical analysis literature. The term shifts all eigenvalues of away from zero, ensuring the matrix is well-conditioned and the inverse is stable.
Interpretation of
The regularization parameter controls the bias-variance trade-off:
- : Recovers OLS. Low bias, high variance. The readout fits the training data closely but may not generalize.
- : The readout approaches . High bias (always predicting near zero), zero variance.
- Optimal : Balances training error and weight magnitude. Typically found by cross-validation or the AGILE optimizer.
The effect on the eigenspectrum of is transparent. If has eigenvalues , then the ridge solution shrinks each component by a factor of:
Large eigenvalues (strong signal directions) are barely affected. Small eigenvalues (noise directions) are suppressed toward zero. This is precisely the behavior needed in reservoir computing, where a few principal components of the reservoir state carry signal and the rest carry noise.
Computational Cost
Computing requires:
- Forming : operations.
- Forming : operations.
- Solving : operations (or per output with Cholesky factorization).
The dominant cost is . For typical reservoir sizes (), this is fast — seconds on modern hardware. SPIRES uses LAPACKE for the linear solve, leveraging optimized BLAS routines.
SVD Alternative
An equivalent formulation uses the singular value decomposition (SVD) of :
This form is more numerically stable when is extremely ill-conditioned, though the Cholesky approach is faster when applicable. SPIRES uses the normal equations (Equation 4) by default.
Online Delta Rule (Streaming Training)
Motivation
Ridge regression requires collecting all training data before computing . For applications where data arrives continuously or where the target distribution changes over time, an online (incremental) training algorithm is needed.
The Delta Rule
The online delta rule updates after each time step based on the prediction error:
where:
- is the learning rate
- is the current prediction
- is the target at time
- is the current reservoir state
This is a stochastic gradient descent step on the squared error loss . The update is:
Properties
Convergence. For a fixed reservoir driven by a stationary input, the delta rule converges to the least-squares solution as , provided satisfies:
In practice, is set to a small constant (e.g., to ).
Computational cost per step. Each update requires operations — a single outer product. This is negligible compared to the cost of the reservoir state update.
Tracking non-stationary targets. Because the delta rule continuously adapts, it can track slow changes in the target distribution. This makes it suitable for online learning and adaptive control applications.
No regularization. The basic delta rule does not include explicit regularization. Weight decay can be added:
This is the online equivalent of ridge regression, with controlling weight decay.
Recursive Least Squares (Online, Second-Order)
Motivation
The delta rule converges slowly because it uses only first-order (gradient) information. Each step moves in the direction of steepest descent, but the step size is the same in every direction of the weight space regardless of how curved the loss surface is. In directions where the loss changes slowly, the delta rule makes unnecessarily cautious updates; in directions where it changes sharply, the same step size can overshoot.
Recursive Least Squares (RLS) corrects this by maintaining a running estimate of the inverse correlation matrix of the reservoir state, . This allows each step to be scaled according to the local curvature of the loss surface — a second-order method — achieving the same asymptotic solution as ridge regression in far fewer steps.
Derivation
RLS can be derived as a recursive implementation of the normal equations. Suppose at time we have accumulated the inverse correlation matrix:
where is a forgetting factor that exponentially discounts older observations, and initializes .
When a new sample arrives, the Sherman–Morrison–Woodbury identity gives a rank-1 update for without re-inverting the full matrix:
where is the prediction error and is the Kalman gain vector.
Symmetric Shortcut for the Update
Since is symmetric, . Before normalization, was already computed as , where is the denominator. Substituting:
so Equation 10 simplifies to a single outer product:
This avoids a second matrix-vector product and is the form used in the SPIRES implementation.
Properties
Convergence. For and stationary inputs, RLS converges to the ordinary least-squares solution exactly after steps (in exact arithmetic), compared to the steps required by the delta rule. In practice, convergence is reached in far fewer than steps for most reservoir tasks.
Computational cost per step. Each update requires:
- One matrix-vector product :
- One scalar and two rank-1 updates:
Total: per step, dominated by the update.
Memory. Storing requires memory — bytes in double precision. For , this is 2 MB; for , 32 MB. This is the principal cost relative to the delta rule, which requires only .
Forgetting factor. When , older samples are exponentially discounted with effective memory horizon steps. This allows RLS to track slowly non-stationary targets, at the cost of increased variance in the weight estimates. For stationary problems, is recommended.
Initialization. encodes the prior that all weight directions are equally uncertain with variance . A larger (smaller ) produces a more diffuse prior and faster initial adaptation. A common choice is (unit prior).
Batch vs. Streaming: Comparison
| Property | Ridge Regression | RLS | Online Delta Rule |
|---|---|---|---|
| Training mode | Batch (offline) | Streaming (online) | Streaming (online) |
| Data requirement | All data upfront | One sample at a time | One sample at a time |
| Optimality | Global optimum (exact) | Exact after steps () | Asymptotically optimal |
| Regularization | (Tikhonov) | (initial prior) | (weight decay) |
| Computational cost | total | per step | per step |
| Memory requirement | for | for | for |
| Non-stationary targets | Not supported | Supported () | Naturally supported |
| Hyperparameter sensitivity | only | , | High (learning rate ) |
When to Use Which
Use ridge regression when:
- The training data is fixed and available in advance.
- An exact global optimum is desired.
- The dataset fits comfortably in memory ( bytes).
Use RLS when:
- Data arrives as a stream but fast convergence is required.
- memory is affordable (typical for ).
- The target distribution is slowly non-stationary ().
Use the online delta rule when:
- Memory is severely constrained and is not affordable.
- The reservoir is very large and the per-step cost of RLS is prohibitive.
- The application is embedded or resource-constrained and convergence speed is secondary.
- The target distribution changes rapidly and continuous tracking is more important than fast convergence.
In practice, RLS is the preferred online method when memory permits. The delta rule is reserved for deployments where the memory of RLS is not available.
Connection to Reservoir Computing Theory
The fact that only the readout layer is trained has profound theoretical implications:
Universality. A reservoir with the echo state property and a sufficiently rich state space can approximate any fading-memory filter to arbitrary accuracy, provided the readout is powerful enough. Since linear readouts are universal approximators when the reservoir provides a sufficiently rich feature expansion, the combination of a random reservoir + linear readout is a universal function approximator for temporal signals.
No vanishing/exploding gradients. Because no gradients are propagated through the recurrent dynamics, the training is immune to the vanishing and exploding gradient problems that plague backpropagation-through-time in conventional RNNs.
Convexity. The ridge regression objective (Equation 3) is a strictly convex function of . There is a unique global minimum, no local minima, and no saddle points. Training is deterministic and reproducible.
Separation of dynamics and learning. The reservoir dynamics (determined by , , neuron model, and topology) and the learning (determined by and ) are completely decoupled. This allows them to be designed and optimized independently, which is the architectural advantage exploited by the AGILE optimizer.
References
- Jaeger, H. (2001). The “echo state” approach to analysing and training recurrent neural networks. GMD Report 148.
- Lukoševičius, M., & Jaeger, H. (2009). Reservoir computing approaches to recurrent neural network training. Computer Science Review, 3(3), 127—149.
- Tikhonov, A. N., & Arsenin, V. Y. (1977). Solutions of Ill-Posed Problems. Winston & Sons.
- Bishop, C. M. (2006). Pattern Recognition and Machine Learning, Chapter 3. Springer.
- Widrow, B., & Hoff, M. E. (1960). Adaptive switching circuits. IRE WESCON Convention Record, Part 4, 96—104.
- Haykin, S. (2002). Adaptive Filter Theory (4th ed.), Chapter 13: Recursive Least-Squares Estimation. Prentice Hall.
- Sussillo, D., & Abbott, L. F. (2009). Generating coherent sequences by learning in continuous-time recurrent networks. Neuron, 63(4), 544—557. (FORCE learning — RLS applied to reservoir readout training.)
← Spectral Radius | Case Studies: Spoken Digit Recognition →