Training, adaptation, compression, and systems techniques · Training, fine-tuning, adaptation, compression, and systems techniques · TRN025 · Training method
Elastic weight consolidation
Penalizes changes to parameters estimated to be important for a previous task.
In CodeSplash
A CodeSplash method runs this entry in Python and R. Set it up from the method's page.
- Convolutional neural network (CNN) Experimental
- FT-Transformer Experimental
- TabM (parameter-efficient MLP ensemble) Experimental
- Deep neural network (torch MLP) Verified in Python and R
Do it in CodeSplash Run it on your own data, in Python or R.
- Availability
- Runs in CodeSplash
- Code example
- Component demo, not a trained model
- Who ran it
- CodeSplash's run and the reference's record
- CodeSplash's run
- Verified in Python and R through learn.cnn, learn.ft_transformer, learn.tabm, learn.torch_mlp. The reference's example ran in Python and R here, and they agree.
- The reference's record
- Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.
Purpose
Penalizes changes to parameters estimated to be important for a previous task.
Question / hypotheses
Does this intervention improve the intended quality, adaptation, resource, or reliability objective under a controlled comparison? It defines a method, not an intrinsic null-hypothesis test.
Architecture / computational structure
The current task loss is augmented by a diagonal quadratic penalty centered at stored previous weights.
Assumptions
The diagonal importance approximation is limited and depends on how the Fisher information is estimated. Task boundaries and the availability of earlier data shape the procedure.
Formula / computational definition
Parameters and notation
Learned: current theta. Stored: previous theta-star and importance F. Hyperparameters: penalty lambda, Fisher sampling, task consolidation/online decay, trainable layers.
Fitting, fine-tuning, and adaptation
Estimate importance on permitted old-task data, then fine-tune with the retention penalty. Evaluate a task-by-task performance matrix to reveal forgetting and interference.
How to use and calibrate
Compare retained old-task quality and new-task learning at matched adaptation budgets. Example: sequentially adapt an encoder to new domains.
Example application
sequentially adapt an encoder to new domains.
Interpretation / pitfalls
Watch out
Strong penalties may prevent necessary adaptation; weak penalties may fail to retain knowledge. A diagonal Fisher is not a complete model of functional importance.
Python and R code examples
Scope: numerical mechanism demonstration. Validation: Python executed successfully on the supplied synthetic inputs; R reviewed but not executed (Rscript unavailable).
Python and R
The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.
Component demo, not a trained model — numerical mechanism demonstration. · needs numpy
import numpy as np
w=np.array([1.2,.8]); old=np.array([1.,1.]); F=np.array([10.,1.]); lam=2.
print(lam/2*np.sum(F*(w-old)**2))
Component demo, not a trained model — numerical mechanism demonstration.
w <- c(1.2,.8); old <- c(1,1); F <- c(10,1); lambda <- 2
print(lambda/2*sum(F*(w-old)^2))
Sources
- Primary/official source 1arxiv.org
From the CodeSplash reference, entry TRN025.